import {
  buildStaticEnvConfig,
  getConfigSingleton
} from "./chunk-KWJJMO7M.js";
import {
  createPerModuleLoadResource
} from "./chunk-4DOLQJG3.js";

// src/islands/Island.tsx
import { lazy as lazy2, Suspense as Suspense2, useId as useId2 } from "react";

// src/renderContext.tsx
import {
  createContext,
  useContext,
  useRef,
  useLayoutEffect
} from "react";

// src/asyncLocalStorage.ts
var AsyncStorageForServerContext;
async function wrapServerCodeWithRenderContext(contextValue, callback) {
  var _a;
  if (!((_a = import.meta.env) == null ? void 0 : _a.SSR)) {
    throw new Error(`Cannot use server context from browser`);
  }
  if (!AsyncStorageForServerContext) {
    const { AsyncLocalStorage } = await import("async_hooks");
    AsyncStorageForServerContext = new AsyncLocalStorage();
  }
  AsyncStorageForServerContext.run(contextValue, () => {
    callback();
  });
}
var getRenderContextFromAsyncLocalStorage = () => {
  var _a;
  if (!((_a = import.meta.env) == null ? void 0 : _a.SSR)) {
    throw new Error(`Cannot use server context from browser`);
  }
  return AsyncStorageForServerContext ? AsyncStorageForServerContext.getStore() : void 0;
};

// src/renderContext.tsx
import { jsx } from "react/jsx-runtime";
var renderSequenceNum = 1;
var createNewServerRequestMap = (renderId) => {
  if (import.meta && import.meta.env && import.meta.env.DEBUG) {
    return /* @__PURE__ */ new Map([["__tempRenderId", renderId]]);
  }
  return /* @__PURE__ */ new Map();
};
var createServerRenderContext = (pageUrl, environmentConfig, sharedServerRequestData) => {
  const renderId = (renderSequenceNum++).toString(16);
  const perServerRequestData = sharedServerRequestData ?? createNewServerRequestMap(renderId);
  return {
    pageUrl,
    environmentConfig,
    islands: [],
    inlineAssets: [],
    renderId,
    perServerRequestData,
    messagesForBrowser: [],
    // Satisfies ServerRenderContextValueType
    entryPointBasePath: null,
    criticalDevErrors: [],
    modules: {},
    contentDescriptors: { modules: {}, dndAreas: {} }
  };
};
var createServerRenderContextV2 = (pageUrl, {
  environmentConfig,
  entryPointBasePath,
  sharedServerRequestData,
  supplementalFieldValues,
  messagesForBrowser = [],
  resolvedDataDependencies
}) => {
  const renderId = (renderSequenceNum++).toString(16);
  const perServerRequestData = sharedServerRequestData ?? createNewServerRequestMap(renderId);
  return {
    pageUrl,
    environmentConfig,
    islands: [],
    inlineAssets: [],
    renderId,
    perServerRequestData,
    messagesForBrowser,
    entryPointBasePath,
    supplementalFieldValues,
    criticalDevErrors: [],
    modules: {},
    contentDescriptors: {
      modules: {},
      dndAreas: {}
    },
    resolvedDataDependencies
  };
};
var createEmptyServerRenderContext = () => createServerRenderContextV2(null, { environmentConfig: null });
var ServerRenderContext = createContext(
  createEmptyServerRenderContext()
);
var useServerRenderContext = () => {
  var _a;
  if (!((_a = import.meta.env) == null ? void 0 : _a.SSR)) {
    throw new Error(`Cannot use server context from browser`);
  }
  const contextValueFromAls = getRenderContextFromAsyncLocalStorage();
  if (contextValueFromAls) {
    return contextValueFromAls;
  }
  return useContext(ServerRenderContext);
};
var createClientRenderContext = (hsServerPageUrl, hsBasePath, islands = []) => {
  return {
    pageUrl: hsServerPageUrl,
    islands,
    island: null,
    hydrationFinished: { current: false },
    entryPointBasePath: hsBasePath
  };
};
var ClientRenderContext = createContext(
  createClientRenderContext(null, null)
);
var ClientRenderContextProvider = ({
  children,
  islands,
  island,
  pageUrl,
  basePath,
  onTopLevelHydrationFinish
}) => {
  const hydrationFinished = useRef(false);
  const contextValue = {
    pageUrl,
    islands,
    hydrationFinished,
    island,
    entryPointBasePath: basePath,
    supplementalFieldValues: island == null ? void 0 : island.supplementalFieldValues,
    resolvedDataDependencies: island == null ? void 0 : island.resolvedDataDependencies
  };
  useLayoutEffect(() => {
    if (hydrationFinished.current) {
      return;
    }
    hydrationFinished.current = true;
    if (onTopLevelHydrationFinish) {
      onTopLevelHydrationFinish();
    }
  }, [onTopLevelHydrationFinish]);
  return /* @__PURE__ */ jsx(ClientRenderContext.Provider, { value: contextValue, children });
};
var useClientRenderContext = () => useContext(ClientRenderContext);
var useRenderContext = () => {
  if (import.meta.env.SSR) {
    return useContext(ServerRenderContext);
  }
  return useContext(ClientRenderContext);
};
var useGetRenderRequestId = () => {
  if (!import.meta.env.SSR) {
    throw new Error("Cannot call useGetRenderRequestId in the browser");
  }
  return useServerRenderContext().renderId;
};
var useGetPerRequestMap_internal = () => {
  if (!import.meta.env.SSR) {
    return void 0;
  }
  const renderContext = useServerRenderContext();
  return renderContext.perServerRequestData;
};
var mergeServerRequestData_internal = (dataA, dataB) => {
  const toMerge = [...dataA, ...dataB];
  if (dataA.has("sharedStateIDs") && dataB.has("sharedStateIDs")) {
    const mergedSet = /* @__PURE__ */ new Set([
      ...dataA.get("sharedStateIDs"),
      ...dataB.get("sharedStateIDs")
    ]);
    toMerge.push(["sharedStateIDs", mergedSet]);
  }
  return new Map(toMerge);
};
var useInlineHeadAsset = (renderFunc) => {
  if (!import.meta.env || import.meta.env.SSR !== true) {
    return;
  }
  const renderContext = useServerRenderContext();
  renderContext.inlineAssets.push({
    type: "inline_html",
    location: "CSS_HEAD",
    render: renderFunc
  });
};

// src/islands/constants.ts
var UNSET_SHARED_STATE_ID = "hs-basic-shared-state-unset-id";

// src/islands/ExistingIslandContext.tsx
import { createContext as createContext2, useContext as useContext2 } from "react";
var ExistingIslandContext = createContext2(null);
var ExistingIslandContextProvider = ExistingIslandContext.Provider;
function useIsInsideIsland() {
  return useContext2(ExistingIslandContext) != null;
}

// src/islands/SharedIslandReducer.tsx
import {
  createContext as createContext3,
  useCallback,
  useContext as useContext3,
  useId,
  useMemo,
  useReducer,
  useRef as useRef2,
  useSyncExternalStore
} from "react";
import { jsx as jsx2 } from "react/jsx-runtime";
var SharedIslandStateContext = createContext3({
  id: UNSET_SHARED_STATE_ID,
  state: null
});
function useSharedIslandStateID() {
  return useContext3(SharedIslandStateContext).id;
}
function useHasSharedIslandState() {
  return useSharedIslandStateID() !== UNSET_SHARED_STATE_ID;
}
function SharedIslandReducer({
  children,
  value,
  id: id2,
  reducer,
  customReducerFunc
}) {
  if (useHasSharedIslandState()) {
    throw new Error(`Cannot nest SharedIsland components`);
  } else if (!import.meta.env.SSR) {
    throw new Error(
      `Shared state can only be defined on the server, not on the client`
    );
  } else if (value === void 0) {
    throw new Error(`No initial value defined for shared state`);
  } else if (useIsInsideIsland()) {
    throw new Error(`Shared state cannot be defined inside an island`);
  }
  const sharedStateID = id2 ?? `hs-ss-${useId()}`;
  const renderContext = useServerRenderContext();
  let reducerFuncModuleId;
  if (!customReducerFunc) {
    reducerFuncModuleId = reducer.moduleId;
  }
  const sharedStateValue = {
    value,
    reducerFuncModuleId,
    hasCustomReducerFunc: !!customReducerFunc
  };
  renderContext.perServerRequestData.set(sharedStateID, sharedStateValue);
  const sharedStateIDs = renderContext.perServerRequestData.get("sharedStateIDs") ?? /* @__PURE__ */ new Set();
  if (!sharedStateIDs.has(sharedStateID)) {
    renderContext.perServerRequestData.set(
      "sharedStateIDs",
      /* @__PURE__ */ new Set([...sharedStateIDs, sharedStateID])
    );
  }
  return /* @__PURE__ */ jsx2(
    SharedIslandStateContext.Provider,
    {
      value: {
        id: sharedStateID,
        state: sharedStateValue
      },
      children
    }
  );
}
var clientInitialized = false;
function useSharedIslandReducerInternal(customReducerFunc) {
  if (import.meta.env.SSR) {
    return useSharedIslandReducerServerHelper();
  } else {
    if (!clientInitialized) {
      initSharedStateForClient();
      clientInitialized = true;
    }
    return useSharedIslandReducerClientHelper(customReducerFunc);
  }
}
function useSharedIslandReducer() {
  return useSharedIslandReducerInternal();
}
var typedWindow;
var updatedSharedState;
var dispatchById;
var reducerOwnerClaimed;
function initSharedStateForClient() {
  typedWindow = window;
  updatedSharedState = typedWindow.__hsSS = typedWindow.__hsSS ?? /* @__PURE__ */ new Map();
  dispatchById = /* @__PURE__ */ new Map();
  reducerOwnerClaimed = /* @__PURE__ */ new Set();
  document.addEventListener(
    "hs-shared-state-action",
    (event) => {
      const detail = event.detail;
      if (!detail || !detail.id || !detail.action) {
        console.error(
          "Invalid hs-shared-state-action event, must have e.detail.id and e.detail.action"
        );
      } else if (!Object.prototype.hasOwnProperty.call(typedWindow.__hsSSInit, detail.id)) {
        console.error(
          `Invalid hs-shared-state-action event, shared state ID does not exist: ${detail.id}`
        );
      } else {
        const dispatch = dispatchById.get(detail.id);
        dispatch(detail.action);
      }
    }
  );
  document.addEventListener(
    "hs-shared-state-update",
    (event) => {
      const detail = event.detail;
      if (!detail || !detail.id || !detail.newValue) {
        console.error(
          "Invalid hs-shared-state-update event, must have e.detail.id and e.detail.newValue"
        );
      } else if (!Object.prototype.hasOwnProperty.call(typedWindow.__hsSSInit, detail.id)) {
        console.error(
          `Invalid hs-shared-state-update event, shared state ID does not exist: ${detail.id}`
        );
      } else if (detail._hsFrom === "update-trigger") {
        return;
      } else {
        const dispatch = dispatchById.get(detail.id);
        dispatch(detail.newValue);
      }
    }
  );
}
function getInitialSharedStateFor(id2) {
  return typedWindow.__hsSSInit[id2].value;
}
function getSharedReducerModuleUrlFor(id2) {
  return typedWindow.__hsSSInit[id2].reducerFuncModuleUrl;
}
function getLatestSharedStateFor(id2) {
  if (updatedSharedState.has(id2)) {
    return updatedSharedState.get(id2);
  }
  const initialValue = getInitialSharedStateFor(id2);
  updatedSharedState.set(id2, initialValue);
  return initialValue;
}
function useGetStateSnapshotFunc(id2) {
  return useMemo(() => () => getLatestSharedStateFor(id2), [id2]);
}
function useGetInitialStateSnapshotFunc(id2) {
  return useMemo(() => () => getInitialSharedStateFor(id2), [id2]);
}
function useSubscriberForSharedState(id2) {
  return useMemo(
    () => (listenCallback) => {
      const callbackIfIDMatches = (event) => {
        if (event.detail && event.detail.id === id2) {
          listenCallback();
        }
      };
      document.addEventListener("hs-shared-state-update", callbackIfIDMatches);
      return () => {
        document.removeEventListener(
          "hs-shared-state-update",
          callbackIfIDMatches
        );
      };
    },
    [id2]
  );
}
function triggerUpdateForStateID(sharedStateID, newValue) {
  const event = new CustomEvent("hs-shared-state-update", {
    detail: {
      id: sharedStateID,
      newValue,
      _hsFrom: "update-trigger"
    }
  });
  document.dispatchEvent(event);
}
function useSharedIslandReducerServerHelper() {
  const { state, id: id2 } = useContext3(SharedIslandStateContext);
  let updaterFunc;
  if (import.meta.env.DEBUG) {
    updaterFunc = () => {
      throw new Error(`Cannot update shared state on server`);
    };
  }
  return [state.value, updaterFunc, id2];
}
function useSharedIslandReducerClientHelper(customReducerFunc) {
  const renderContext = useClientRenderContext();
  const { sharedStateID } = renderContext.island;
  const value = getLatestSharedStateFor(sharedStateID);
  const reducerFuncModuleUrl = getSharedReducerModuleUrlFor(sharedStateID);
  const hasReducerBeenClaimedYet = reducerOwnerClaimed.has(sharedStateID);
  const claimedRef = useRef2();
  let origReducerFunc;
  if (reducerFuncModuleUrl) {
    const reducerResource = createPerModuleLoadResource(
      reducerFuncModuleUrl
    );
    origReducerFunc = reducerResource.read().default;
  } else if (customReducerFunc) {
    origReducerFunc = customReducerFunc;
  } else {
    throw new Error(
      "Missing reducer module ID for SharedIslandReducer, did you pass reducer={...} from an import `...?client` reference?"
    );
  }
  if (!hasReducerBeenClaimedYet || claimedRef.current === sharedStateID) {
    if (!hasReducerBeenClaimedYet) {
      reducerOwnerClaimed.add(sharedStateID);
      claimedRef.current = sharedStateID;
    }
    const reducerFunc = useCallback(
      (state, action) => {
        const newState = origReducerFunc(state, action);
        if (!Object.is(state, newState)) {
          updatedSharedState.set(sharedStateID, newState);
          triggerUpdateForStateID(sharedStateID, newState);
        }
        return newState;
      },
      [origReducerFunc]
    );
    const [currentState, dispatch] = useReducer(reducerFunc, value);
    if (!dispatchById.has(sharedStateID)) {
      dispatchById.set(sharedStateID, dispatch);
    }
    return [currentState, dispatch, sharedStateID];
  } else {
    const currentState = useSyncExternalStore(
      useSubscriberForSharedState(sharedStateID),
      useGetStateSnapshotFunc(sharedStateID),
      useGetInitialStateSnapshotFunc(sharedStateID)
    );
    return [currentState, dispatchById.get(sharedStateID), sharedStateID];
  }
}

// src/islands/sortIslandRootsByPriority.ts
function priorityByHydrateOnType(hydrateOn) {
  const hydrationPriorty = ["load", "visible", "idle"];
  const index = hydrationPriorty.indexOf(hydrateOn);
  if (index === -1) {
    throw new Error(`Unknown hydrateOn type (${hydrateOn})`);
  }
  return index;
}
function sortIslandRootsByPriority(roots) {
  return Array.from(roots.values()).sort((a, b) => {
    if (a.hydrateOn === b.hydrateOn) {
      return a.priority - b.priority;
    } else {
      return priorityByHydrateOnType(a.hydrateOn) - priorityByHydrateOnType(b.hydrateOn);
    }
  });
}

// src/islands/RenderIslandSeparately.tsx
import { lazy, Suspense, useContext as useContext4 } from "react";

// src/islands/RenderTreeSeparately/index.ts
async function load() {
  if (import.meta.env && !import.meta.env.SSR) {
    throw new Error("Never supposed to get here");
  } else {
    const result = await import("./RenderTreeSeparately-T6CL43QJ.js");
    return result;
  }
}

// src/islands/buildIslandID.ts
function buildIslandID(baseId) {
  if (baseId.startsWith(":") && baseId.endsWith(":")) {
    baseId = baseId.substring(1, baseId.length - 1);
  }
  return `island-${baseId}`;
}
function buildIslandIdentifierPrefix(islandID) {
  return `${islandID}-`;
}

// src/islands/RenderIslandSeparately.tsx
import { jsx as jsx3 } from "react/jsx-runtime";
function RenderIslandSeparately({
  id: id2,
  lazyModule,
  componentProps,
  WrapperElement,
  wrapperStyle,
  wrapperClassName,
  Wrapper
}) {
  const renderContext = useServerRenderContext();
  const sharedIslandState = useContext4(SharedIslandStateContext);
  const LazyComponent = lazy(lazyModule);
  const RenderTreeSeparately = lazy(async () => ({
    default: (await load()).RenderTreeSeparately
  }));
  const uniqueRenderID = { id: `${renderContext.renderId}-${id2}` };
  let innerTreeElements = /* @__PURE__ */ jsx3(LazyComponent, { islandId: id2, ...componentProps });
  if (sharedIslandState.id !== UNSET_SHARED_STATE_ID) {
    innerTreeElements = /* @__PURE__ */ jsx3(SharedIslandStateContext.Provider, { value: sharedIslandState, children: innerTreeElements });
  }
  if (Wrapper) {
    const LazyWrapper = lazy(Wrapper);
    innerTreeElements = /* @__PURE__ */ jsx3(LazyWrapper, { children: innerTreeElements });
  }
  innerTreeElements = /* @__PURE__ */ jsx3(
    Suspense,
    {
      fallback: `server render fail/waiting for ${id2} (separate island render, inside)`,
      children: /* @__PURE__ */ jsx3(ServerRenderContext.Provider, { value: renderContext, children: /* @__PURE__ */ jsx3(ExistingIslandContextProvider, { value: lazyModule.moduleId, children: innerTreeElements }) })
    }
  );
  return /* @__PURE__ */ jsx3(
    Suspense,
    {
      fallback: `server render fail/waiting for ${id2} (separate island render, outside)`,
      children: /* @__PURE__ */ jsx3(
        RenderTreeSeparately,
        {
          uniqueRenderID,
          innerTree: innerTreeElements,
          WrapperElement,
          wrapperID: id2,
          wrapperStyle,
          wrapperClassName,
          renderOptions: {
            identifierPrefix: buildIslandIdentifierPrefix(id2),
            onError: (error) => {
              renderContext.messagesForBrowser.push({
                level: "error",
                parameters: [
                  `Error in island ${lazyModule.moduleId}`,
                  error.name,
                  error.stack
                ]
              });
            }
          }
        }
      )
    }
  );
}

// src/islands/Island.tsx
import { jsx as jsx4 } from "react/jsx-runtime";
function Island({
  id: id2,
  wrapperTag: WrapperElement = "div",
  wrapperStyle,
  wrapperClassName,
  module,
  hydrateOn = "load",
  clientOnly = false,
  priority = 0,
  Wrapper,
  ...moduleProps
}) {
  const instanceId = buildIslandID(useId2());
  const resolvedId = id2 ?? instanceId;
  const isInsideIsland = useIsInsideIsland();
  const sharedStateID = useSharedIslandStateID();
  if (!module.moduleId) {
    throw new Error(
      `No moduleId found on module. Module must be from import with ?island suffix.`
    );
  }
  for (const key in moduleProps) {
    if (Object.hasOwn(moduleProps, key)) {
      const type = typeof moduleProps[key];
      if (type === "function") {
        throw new Error(
          `All pass-though props to Island must be serializable. No functions, etc (${key})`
        );
      }
    }
  }
  if (import.meta.env.SSR && !isInsideIsland) {
    const islandData = {
      id: resolvedId,
      moduleName: module.moduleName,
      moduleId: module.moduleId,
      hydrateOn,
      clientOnly,
      priority,
      props: moduleProps,
      sharedStateID: sharedStateID !== UNSET_SHARED_STATE_ID ? sharedStateID : void 0
    };
    if (Wrapper) {
      islandData.wrapperModuleId = Wrapper.moduleId;
    }
    useAddIslandRoot(islandData);
  }
  if (clientOnly) {
    return /* @__PURE__ */ jsx4(
      WrapperElement,
      {
        "data-hs-island": true,
        id: resolvedId,
        style: wrapperStyle,
        className: wrapperClassName
      }
    );
  } else if (import.meta.env.SSR) {
    return /* @__PURE__ */ jsx4(
      RenderIslandSeparately,
      {
        id: resolvedId,
        lazyModule: module,
        componentProps: moduleProps,
        WrapperElement,
        wrapperStyle,
        wrapperClassName,
        Wrapper
      }
    );
  }
  const LazyComponent = lazy2(module);
  return /* @__PURE__ */ jsx4(ExistingIslandContextProvider, { value: module.moduleId, children: /* @__PURE__ */ jsx4(
    WrapperElement,
    {
      "data-hs-island": true,
      id: resolvedId,
      style: wrapperStyle,
      className: wrapperClassName,
      children: /* @__PURE__ */ jsx4(Suspense2, { fallback: `server render fail/waiting for ${resolvedId}`, children: /* @__PURE__ */ jsx4(LazyComponent, { islandId: resolvedId, ...moduleProps }) })
    }
  ) });
}
function useAddIslandRoot(newIsland) {
  if (!import.meta.env.SSR) {
    throw new Error("Cannot call useAddIslandRoot in the browser");
  }
  const renderContext = useServerRenderContext();
  if (renderContext.islands.some((i) => i.id === newIsland.id)) {
    throw new Error(`Duplicate island ID ${newIsland.id}`);
  }
  newIsland.resolvedDataDependencies = renderContext.resolvedDataDependencies;
  newIsland.supplementalFieldValues = renderContext.supplementalFieldValues;
  renderContext.islands = sortIslandRootsByPriority([
    ...renderContext.islands,
    newIsland
  ]);
}
var Island_default = Island;

// src/constants.ts
var MAX_AGE_CACHE_FOR_AN_HOUR = {
  cacheControl: {
    maxAge: 3600,
    sharedMaxAge: 3600
  }
};
var ALL_MODULE_DATA_FETCH_DEPENDENCY_TYPES = [
  "moduleProps",
  "moduleProps-urlWithoutQuery",
  "moduleProps-urlWithQuery",
  "moduleProps-urlWithQuery-contact",
  "moduleProps-urlWithQuery-contact-fullRequest"
];
var MODULE_DATA_FETCH_DEPENDENCY_AS_OBJECT = /* @__PURE__ */ new Map([
  [
    void 0,
    {
      moduleProps: true,
      urlWithoutQuery: false,
      urlWithQuery: false,
      contact: false,
      fullRequest: false
    }
  ],
  [
    "moduleProps",
    {
      moduleProps: true,
      urlWithoutQuery: false,
      urlWithQuery: false,
      contact: false,
      fullRequest: false
    }
  ],
  [
    "moduleProps-urlWithoutQuery",
    {
      moduleProps: true,
      urlWithoutQuery: true,
      urlWithQuery: false,
      contact: false,
      fullRequest: false
    }
  ],
  [
    "moduleProps-urlWithQuery",
    {
      moduleProps: true,
      urlWithoutQuery: true,
      urlWithQuery: true,
      contact: false,
      fullRequest: false
    }
  ],
  [
    "moduleProps-urlWithQuery-contact",
    {
      moduleProps: true,
      urlWithoutQuery: true,
      urlWithQuery: true,
      contact: true,
      fullRequest: false
    }
  ],
  [
    "moduleProps-urlWithQuery-contact-fullRequest",
    {
      moduleProps: true,
      urlWithoutQuery: true,
      urlWithQuery: true,
      contact: true,
      fullRequest: true
    }
  ]
]);

// src/getters/getEnvironmentConfig.ts
function getEnvironmentConfig() {
  if (import.meta.env.SSR) {
    return useServerRenderContext().environmentConfig;
  } else {
    return getConfigSingleton();
  }
}

// src/getters/account.ts
var getPortalID = () => {
  return getEnvironmentConfig().getPortalID();
};
var getHublet = () => {
  return getEnvironmentConfig().getHublet();
};

// src/getters/environment.ts
var getIsDeployed = () => {
  return getEnvironmentConfig().getIsDeployed();
};
var getIsUngatedFor = (gateName) => {
  return getEnvironmentConfig().getGates().includes(gateName);
};
var getHSEnv = () => {
  return getEnvironmentConfig().getInternalHSEnv();
};

// src/internal/getters.ts
var getInternalRenderSource = () => {
  return getEnvironmentConfig().getInternalRenderSource();
};

// src/getters/nonce.ts
var SCRIPT_NONCE_PLACEHOLDER = "hs-random-nonce";
var STYLE_NONCE_PLACEHOLDER = "hs-random-style-nonce";
function getScriptNonce() {
  return getInternalRenderSource() === "worker" ? SCRIPT_NONCE_PLACEHOLDER : void 0;
}
function getStyleNonce() {
  return getInternalRenderSource() === "worker" ? STYLE_NONCE_PLACEHOLDER : void 0;
}

// src/hooks/ssr.ts
import { useState, useEffect, useRef as useRef3 } from "react";
var useIsServerRender = () => {
  const isBrowser = typeof window !== "undefined" && window.document && window.document.createElement;
  return !isBrowser;
};
var useIsServerOrFirstClientRender = () => {
  const isServerRender = useIsServerRender();
  const [hasRenderedOnClient, setHasRenderedOnClient] = useState(false);
  if (isServerRender) {
    return true;
  } else if (!hasRenderedOnClient) {
    Promise.resolve().then(() => setHasRenderedOnClient(true));
    return true;
  }
  return false;
};
var useIsAfterMount = () => {
  const [isMounted, setIsMounted] = useState(false);
  useEffect(() => {
    setIsMounted(true);
  }, []);
  return isMounted;
};
var useIsAfterMountWithoutForcingRerender = () => {
  const afterMountRef = useRef3(false);
  useEffect(() => {
    afterMountRef.current = true;
  }, []);
  return afterMountRef.current;
};
var useAfterIslandHydration = () => {
  const isServerRender = useIsServerRender();
  if (isServerRender) {
    return false;
  }
  const clientRenderContext = useClientRenderContext();
  const clientOnly = clientRenderContext.island.clientOnly;
  const alreadyHydrated = clientRenderContext.hydrationFinished.current === true;
  const isPostMount = useIsAfterMount();
  return isPostMount || alreadyHydrated || clientOnly;
};

// src/hooks/pageUrl.ts
import { useEffect as useEffect2, useState as useState2, useId as useId3 } from "react";
var listenToNavigation;
var setupListenerFor;
var removeListenerFor;
if (import.meta && import.meta.env && !import.meta.env.SSR) {
  let lastNavigatedToURL = new URL(window.location.href);
  const stateSetCallbacksById = /* @__PURE__ */ new Map();
  listenToNavigation = () => {
    lastNavigatedToURL = new URL(window.location.href);
    for (const stateCb of stateSetCallbacksById.values()) {
      stateCb(lastNavigatedToURL);
    }
  };
  setupListenerFor = (id2, stateCb, originalUrl) => {
    if (stateSetCallbacksById.size === 0) {
      window.addEventListener("popstate", listenToNavigation);
      window.addEventListener("pushstate", listenToNavigation);
      window.addEventListener("hashchange", listenToNavigation);
      window.addEventListener("replacestate", listenToNavigation);
    }
    stateSetCallbacksById.set(id2, stateCb);
    if (originalUrl.toString() !== lastNavigatedToURL.toString()) {
      stateCb(lastNavigatedToURL);
    }
  };
  removeListenerFor = (id2) => {
    stateSetCallbacksById.delete(id2);
    if (stateSetCallbacksById.size === 0) {
      window.removeEventListener("pushstate", listenToNavigation);
      window.removeEventListener("popstate", listenToNavigation);
      window.removeEventListener("hashchange", listenToNavigation);
      window.removeEventListener("replacestate", listenToNavigation);
    }
  };
}
var useCurrentClientPageURL = (originalUrl, componentId) => {
  if (import.meta.env.SSR) {
    return null;
  }
  const afterHydration = useAfterIslandHydration();
  const [currentURL, setCurrentURL] = useState2(
    afterHydration ? new URL(window.location.href) : null
  );
  useEffect2(() => {
    setupListenerFor(componentId, setCurrentURL, originalUrl);
    return () => removeListenerFor(componentId);
  }, []);
  return currentURL;
};
var useInitialPageUrl = () => {
  const renderContext = useRenderContext();
  if (!renderContext.pageUrl) {
    throw new Error("No pageUrl in render context");
  }
  const url = new URL(renderContext.pageUrl);
  return url;
};
var usePageUrl = () => {
  const componentId = `${useId3()}pageUrl`;
  const originalUrl = useInitialPageUrl();
  const currentClientURL = useCurrentClientPageURL(originalUrl, componentId);
  return currentClientURL ?? originalUrl;
};
var pushHistoryState = (data = {}, url) => {
  window.history.pushState(data, "", url);
  window.dispatchEvent(new Event("pushstate"));
};

// src/hooks/basePath.ts
var useBasePath = () => {
  const renderContext = useRenderContext();
  if (!renderContext.entryPointBasePath) {
    throw new Error("No basePath in render context");
  }
  return renderContext.entryPointBasePath;
};

// src/hooks/debug.ts
var isDebugUrl = (url) => {
  if (!url) {
    return false;
  }
  const hsDebugParam = url.searchParams.get("hsDebug") || "";
  return hsDebugParam.toLowerCase() === "true";
};
var isDebugUrlString = (urlString) => {
  return isDebugUrl(new URL(urlString, "http://notreal.dev"));
};
var useIsDebug = () => {
  return isDebugUrl(useInitialPageUrl());
};

// src/log.ts
var logInfo = (...args) => {
  console.log(...args);
  if (import.meta.env.SSR) {
    const serverContext = useServerRenderContext();
    serverContext.messagesForBrowser.push({ level: "info", parameters: args });
  }
};
var logWarn = (...args) => {
  console.warn(...args);
  if (import.meta.env.SSR) {
    const serverContext = useServerRenderContext();
    serverContext.messagesForBrowser.push({ level: "warn", parameters: args });
  }
};
var logError = (...args) => {
  console.error(...args);
  if (import.meta.env.SSR) {
    const serverContext = useServerRenderContext();
    serverContext.messagesForBrowser.push({ level: "error", parameters: args });
  }
};
var logInfoDebugOnly = (...args) => {
  if (useIsDebug()) {
    logInfo(...args);
  }
};
var logWarnDebugOnly = (...args) => {
  if (useIsDebug()) {
    logWarn(...args);
  }
};
var logErrorDebugOnly = (...args) => {
  if (useIsDebug()) {
    logError(...args);
  }
};

// src/hooks/useAvailableTranslations.tsx
var ISO639CodeEnum = /* @__PURE__ */ ((ISO639CodeEnum2) => {
  ISO639CodeEnum2["AF"] = "af";
  ISO639CodeEnum2["AF_NA"] = "af-NA";
  ISO639CodeEnum2["AF_ZA"] = "af-ZA";
  ISO639CodeEnum2["AGQ"] = "agq";
  ISO639CodeEnum2["AGQ_CM"] = "agq-CM";
  ISO639CodeEnum2["AK"] = "ak";
  ISO639CodeEnum2["AK_GH"] = "ak-GH";
  ISO639CodeEnum2["AM"] = "am";
  ISO639CodeEnum2["AM_ET"] = "am-ET";
  ISO639CodeEnum2["ANN"] = "ann";
  ISO639CodeEnum2["ANN_NG"] = "ann-NG";
  ISO639CodeEnum2["AR"] = "ar";
  ISO639CodeEnum2["AR_001"] = "ar-001";
  ISO639CodeEnum2["AR_AE"] = "ar-AE";
  ISO639CodeEnum2["AR_BH"] = "ar-BH";
  ISO639CodeEnum2["AR_DJ"] = "ar-DJ";
  ISO639CodeEnum2["AR_DZ"] = "ar-DZ";
  ISO639CodeEnum2["AR_EG"] = "ar-EG";
  ISO639CodeEnum2["AR_EH"] = "ar-EH";
  ISO639CodeEnum2["AR_ER"] = "ar-ER";
  ISO639CodeEnum2["AR_IL"] = "ar-IL";
  ISO639CodeEnum2["AR_IQ"] = "ar-IQ";
  ISO639CodeEnum2["AR_JO"] = "ar-JO";
  ISO639CodeEnum2["AR_KM"] = "ar-KM";
  ISO639CodeEnum2["AR_KW"] = "ar-KW";
  ISO639CodeEnum2["AR_LB"] = "ar-LB";
  ISO639CodeEnum2["AR_LY"] = "ar-LY";
  ISO639CodeEnum2["AR_MA"] = "ar-MA";
  ISO639CodeEnum2["AR_MR"] = "ar-MR";
  ISO639CodeEnum2["AR_OM"] = "ar-OM";
  ISO639CodeEnum2["AR_PS"] = "ar-PS";
  ISO639CodeEnum2["AR_QA"] = "ar-QA";
  ISO639CodeEnum2["AR_SA"] = "ar-SA";
  ISO639CodeEnum2["AR_SD"] = "ar-SD";
  ISO639CodeEnum2["AR_SO"] = "ar-SO";
  ISO639CodeEnum2["AR_SS"] = "ar-SS";
  ISO639CodeEnum2["AR_SY"] = "ar-SY";
  ISO639CodeEnum2["AR_TD"] = "ar-TD";
  ISO639CodeEnum2["AR_TN"] = "ar-TN";
  ISO639CodeEnum2["AR_YE"] = "ar-YE";
  ISO639CodeEnum2["AS"] = "as";
  ISO639CodeEnum2["ASA"] = "asa";
  ISO639CodeEnum2["ASA_TZ"] = "asa-TZ";
  ISO639CodeEnum2["AST"] = "ast";
  ISO639CodeEnum2["AST_ES"] = "ast-ES";
  ISO639CodeEnum2["AS_IN"] = "as-IN";
  ISO639CodeEnum2["AZ"] = "az";
  ISO639CodeEnum2["AZ_AZ"] = "az-AZ";
  ISO639CodeEnum2["BAS"] = "bas";
  ISO639CodeEnum2["BAS_CM"] = "bas-CM";
  ISO639CodeEnum2["BE"] = "be";
  ISO639CodeEnum2["BEM"] = "bem";
  ISO639CodeEnum2["BEM_ZM"] = "bem-ZM";
  ISO639CodeEnum2["BEZ"] = "bez";
  ISO639CodeEnum2["BEZ_TZ"] = "bez-TZ";
  ISO639CodeEnum2["BE_BY"] = "be-BY";
  ISO639CodeEnum2["BG"] = "bg";
  ISO639CodeEnum2["BGC"] = "bgc";
  ISO639CodeEnum2["BGC_IN"] = "bgc-IN";
  ISO639CodeEnum2["BG_BG"] = "bg-BG";
  ISO639CodeEnum2["BHO"] = "bho";
  ISO639CodeEnum2["BHO_IN"] = "bho-IN";
  ISO639CodeEnum2["BM"] = "bm";
  ISO639CodeEnum2["BM_ML"] = "bm-ML";
  ISO639CodeEnum2["BN"] = "bn";
  ISO639CodeEnum2["BN_BD"] = "bn-BD";
  ISO639CodeEnum2["BN_IN"] = "bn-IN";
  ISO639CodeEnum2["BO"] = "bo";
  ISO639CodeEnum2["BO_CN"] = "bo-CN";
  ISO639CodeEnum2["BO_IN"] = "bo-IN";
  ISO639CodeEnum2["BR"] = "br";
  ISO639CodeEnum2["BRX"] = "brx";
  ISO639CodeEnum2["BRX_IN"] = "brx-IN";
  ISO639CodeEnum2["BR_FR"] = "br-FR";
  ISO639CodeEnum2["BS"] = "bs";
  ISO639CodeEnum2["BS_BA"] = "bs-BA";
  ISO639CodeEnum2["CA"] = "ca";
  ISO639CodeEnum2["CA_AD"] = "ca-AD";
  ISO639CodeEnum2["CA_ES"] = "ca-ES";
  ISO639CodeEnum2["CA_FR"] = "ca-FR";
  ISO639CodeEnum2["CA_IT"] = "ca-IT";
  ISO639CodeEnum2["CCP"] = "ccp";
  ISO639CodeEnum2["CCP_BD"] = "ccp-BD";
  ISO639CodeEnum2["CCP_IN"] = "ccp-IN";
  ISO639CodeEnum2["CE"] = "ce";
  ISO639CodeEnum2["CEB"] = "ceb";
  ISO639CodeEnum2["CEB_PH"] = "ceb-PH";
  ISO639CodeEnum2["CE_RU"] = "ce-RU";
  ISO639CodeEnum2["CGG"] = "cgg";
  ISO639CodeEnum2["CGG_UG"] = "cgg-UG";
  ISO639CodeEnum2["CHR"] = "chr";
  ISO639CodeEnum2["CHR_US"] = "chr-US";
  ISO639CodeEnum2["CKB"] = "ckb";
  ISO639CodeEnum2["CKB_IQ"] = "ckb-IQ";
  ISO639CodeEnum2["CKB_IR"] = "ckb-IR";
  ISO639CodeEnum2["CS"] = "cs";
  ISO639CodeEnum2["CS_CZ"] = "cs-CZ";
  ISO639CodeEnum2["CU"] = "cu";
  ISO639CodeEnum2["CU_RU"] = "cu-RU";
  ISO639CodeEnum2["CV"] = "cv";
  ISO639CodeEnum2["CV_RU"] = "cv-RU";
  ISO639CodeEnum2["CY"] = "cy";
  ISO639CodeEnum2["CY_GB"] = "cy-GB";
  ISO639CodeEnum2["DA"] = "da";
  ISO639CodeEnum2["DAV"] = "dav";
  ISO639CodeEnum2["DAV_KE"] = "dav-KE";
  ISO639CodeEnum2["DA_DK"] = "da-DK";
  ISO639CodeEnum2["DA_GL"] = "da-GL";
  ISO639CodeEnum2["DE"] = "de";
  ISO639CodeEnum2["DE_AT"] = "de-AT";
  ISO639CodeEnum2["DE_BE"] = "de-BE";
  ISO639CodeEnum2["DE_CH"] = "de-CH";
  ISO639CodeEnum2["DE_DE"] = "de-DE";
  ISO639CodeEnum2["DE_GR"] = "de-GR";
  ISO639CodeEnum2["DE_IT"] = "de-IT";
  ISO639CodeEnum2["DE_LI"] = "de-LI";
  ISO639CodeEnum2["DE_LU"] = "de-LU";
  ISO639CodeEnum2["DJE"] = "dje";
  ISO639CodeEnum2["DJE_NE"] = "dje-NE";
  ISO639CodeEnum2["DOI"] = "doi";
  ISO639CodeEnum2["DOI_IN"] = "doi-IN";
  ISO639CodeEnum2["DSB"] = "dsb";
  ISO639CodeEnum2["DSB_DE"] = "dsb-DE";
  ISO639CodeEnum2["DUA"] = "dua";
  ISO639CodeEnum2["DUA_CM"] = "dua-CM";
  ISO639CodeEnum2["DYO"] = "dyo";
  ISO639CodeEnum2["DYO_SN"] = "dyo-SN";
  ISO639CodeEnum2["DZ"] = "dz";
  ISO639CodeEnum2["DZ_BT"] = "dz-BT";
  ISO639CodeEnum2["EBU"] = "ebu";
  ISO639CodeEnum2["EBU_KE"] = "ebu-KE";
  ISO639CodeEnum2["EE"] = "ee";
  ISO639CodeEnum2["EE_GH"] = "ee-GH";
  ISO639CodeEnum2["EE_TG"] = "ee-TG";
  ISO639CodeEnum2["EL"] = "el";
  ISO639CodeEnum2["EL_CY"] = "el-CY";
  ISO639CodeEnum2["EL_GR"] = "el-GR";
  ISO639CodeEnum2["EN"] = "en";
  ISO639CodeEnum2["EN_001"] = "en-001";
  ISO639CodeEnum2["EN_150"] = "en-150";
  ISO639CodeEnum2["EN_AE"] = "en-AE";
  ISO639CodeEnum2["EN_AG"] = "en-AG";
  ISO639CodeEnum2["EN_AI"] = "en-AI";
  ISO639CodeEnum2["EN_AS"] = "en-AS";
  ISO639CodeEnum2["EN_AT"] = "en-AT";
  ISO639CodeEnum2["EN_AU"] = "en-AU";
  ISO639CodeEnum2["EN_BB"] = "en-BB";
  ISO639CodeEnum2["EN_BE"] = "en-BE";
  ISO639CodeEnum2["EN_BI"] = "en-BI";
  ISO639CodeEnum2["EN_BM"] = "en-BM";
  ISO639CodeEnum2["EN_BS"] = "en-BS";
  ISO639CodeEnum2["EN_BW"] = "en-BW";
  ISO639CodeEnum2["EN_BZ"] = "en-BZ";
  ISO639CodeEnum2["EN_CA"] = "en-CA";
  ISO639CodeEnum2["EN_CC"] = "en-CC";
  ISO639CodeEnum2["EN_CH"] = "en-CH";
  ISO639CodeEnum2["EN_CK"] = "en-CK";
  ISO639CodeEnum2["EN_CM"] = "en-CM";
  ISO639CodeEnum2["EN_CN"] = "en-CN";
  ISO639CodeEnum2["EN_CX"] = "en-CX";
  ISO639CodeEnum2["EN_CY"] = "en-CY";
  ISO639CodeEnum2["EN_DE"] = "en-DE";
  ISO639CodeEnum2["EN_DG"] = "en-DG";
  ISO639CodeEnum2["EN_DK"] = "en-DK";
  ISO639CodeEnum2["EN_DM"] = "en-DM";
  ISO639CodeEnum2["EN_EE"] = "en-EE";
  ISO639CodeEnum2["EN_ER"] = "en-ER";
  ISO639CodeEnum2["EN_FI"] = "en-FI";
  ISO639CodeEnum2["EN_FJ"] = "en-FJ";
  ISO639CodeEnum2["EN_FK"] = "en-FK";
  ISO639CodeEnum2["EN_FM"] = "en-FM";
  ISO639CodeEnum2["EN_FR"] = "en-FR";
  ISO639CodeEnum2["EN_GB"] = "en-GB";
  ISO639CodeEnum2["EN_GD"] = "en-GD";
  ISO639CodeEnum2["EN_GG"] = "en-GG";
  ISO639CodeEnum2["EN_GH"] = "en-GH";
  ISO639CodeEnum2["EN_GI"] = "en-GI";
  ISO639CodeEnum2["EN_GM"] = "en-GM";
  ISO639CodeEnum2["EN_GU"] = "en-GU";
  ISO639CodeEnum2["EN_GY"] = "en-GY";
  ISO639CodeEnum2["EN_HK"] = "en-HK";
  ISO639CodeEnum2["EN_IE"] = "en-IE";
  ISO639CodeEnum2["EN_IL"] = "en-IL";
  ISO639CodeEnum2["EN_IM"] = "en-IM";
  ISO639CodeEnum2["EN_IN"] = "en-IN";
  ISO639CodeEnum2["EN_IO"] = "en-IO";
  ISO639CodeEnum2["EN_JE"] = "en-JE";
  ISO639CodeEnum2["EN_JM"] = "en-JM";
  ISO639CodeEnum2["EN_KE"] = "en-KE";
  ISO639CodeEnum2["EN_KI"] = "en-KI";
  ISO639CodeEnum2["EN_KN"] = "en-KN";
  ISO639CodeEnum2["EN_KY"] = "en-KY";
  ISO639CodeEnum2["EN_LC"] = "en-LC";
  ISO639CodeEnum2["EN_LR"] = "en-LR";
  ISO639CodeEnum2["EN_LS"] = "en-LS";
  ISO639CodeEnum2["EN_LU"] = "en-LU";
  ISO639CodeEnum2["EN_MG"] = "en-MG";
  ISO639CodeEnum2["EN_MH"] = "en-MH";
  ISO639CodeEnum2["EN_MO"] = "en-MO";
  ISO639CodeEnum2["EN_MP"] = "en-MP";
  ISO639CodeEnum2["EN_MS"] = "en-MS";
  ISO639CodeEnum2["EN_MT"] = "en-MT";
  ISO639CodeEnum2["EN_MU"] = "en-MU";
  ISO639CodeEnum2["EN_MV"] = "en-MV";
  ISO639CodeEnum2["EN_MW"] = "en-MW";
  ISO639CodeEnum2["EN_MX"] = "en-MX";
  ISO639CodeEnum2["EN_MY"] = "en-MY";
  ISO639CodeEnum2["EN_NA"] = "en-NA";
  ISO639CodeEnum2["EN_NF"] = "en-NF";
  ISO639CodeEnum2["EN_NG"] = "en-NG";
  ISO639CodeEnum2["EN_NL"] = "en-NL";
  ISO639CodeEnum2["EN_NR"] = "en-NR";
  ISO639CodeEnum2["EN_NU"] = "en-NU";
  ISO639CodeEnum2["EN_NZ"] = "en-NZ";
  ISO639CodeEnum2["EN_PG"] = "en-PG";
  ISO639CodeEnum2["EN_PH"] = "en-PH";
  ISO639CodeEnum2["EN_PK"] = "en-PK";
  ISO639CodeEnum2["EN_PN"] = "en-PN";
  ISO639CodeEnum2["EN_PR"] = "en-PR";
  ISO639CodeEnum2["EN_PW"] = "en-PW";
  ISO639CodeEnum2["EN_RW"] = "en-RW";
  ISO639CodeEnum2["EN_SB"] = "en-SB";
  ISO639CodeEnum2["EN_SC"] = "en-SC";
  ISO639CodeEnum2["EN_SD"] = "en-SD";
  ISO639CodeEnum2["EN_SE"] = "en-SE";
  ISO639CodeEnum2["EN_SG"] = "en-SG";
  ISO639CodeEnum2["EN_SH"] = "en-SH";
  ISO639CodeEnum2["EN_SI"] = "en-SI";
  ISO639CodeEnum2["EN_SL"] = "en-SL";
  ISO639CodeEnum2["EN_SS"] = "en-SS";
  ISO639CodeEnum2["EN_SX"] = "en-SX";
  ISO639CodeEnum2["EN_SZ"] = "en-SZ";
  ISO639CodeEnum2["EN_TC"] = "en-TC";
  ISO639CodeEnum2["EN_TK"] = "en-TK";
  ISO639CodeEnum2["EN_TO"] = "en-TO";
  ISO639CodeEnum2["EN_TT"] = "en-TT";
  ISO639CodeEnum2["EN_TV"] = "en-TV";
  ISO639CodeEnum2["EN_TZ"] = "en-TZ";
  ISO639CodeEnum2["EN_UG"] = "en-UG";
  ISO639CodeEnum2["EN_UM"] = "en-UM";
  ISO639CodeEnum2["EN_US"] = "en-US";
  ISO639CodeEnum2["EN_VC"] = "en-VC";
  ISO639CodeEnum2["EN_VG"] = "en-VG";
  ISO639CodeEnum2["EN_VI"] = "en-VI";
  ISO639CodeEnum2["EN_VU"] = "en-VU";
  ISO639CodeEnum2["EN_WS"] = "en-WS";
  ISO639CodeEnum2["EN_ZA"] = "en-ZA";
  ISO639CodeEnum2["EN_ZM"] = "en-ZM";
  ISO639CodeEnum2["EN_ZW"] = "en-ZW";
  ISO639CodeEnum2["EO"] = "eo";
  ISO639CodeEnum2["EO_001"] = "eo-001";
  ISO639CodeEnum2["ES"] = "es";
  ISO639CodeEnum2["ES_419"] = "es-419";
  ISO639CodeEnum2["ES_AR"] = "es-AR";
  ISO639CodeEnum2["ES_BO"] = "es-BO";
  ISO639CodeEnum2["ES_BR"] = "es-BR";
  ISO639CodeEnum2["ES_BZ"] = "es-BZ";
  ISO639CodeEnum2["ES_CL"] = "es-CL";
  ISO639CodeEnum2["ES_CO"] = "es-CO";
  ISO639CodeEnum2["ES_CR"] = "es-CR";
  ISO639CodeEnum2["ES_CU"] = "es-CU";
  ISO639CodeEnum2["ES_DO"] = "es-DO";
  ISO639CodeEnum2["ES_EA"] = "es-EA";
  ISO639CodeEnum2["ES_EC"] = "es-EC";
  ISO639CodeEnum2["ES_ES"] = "es-ES";
  ISO639CodeEnum2["ES_GQ"] = "es-GQ";
  ISO639CodeEnum2["ES_GT"] = "es-GT";
  ISO639CodeEnum2["ES_HN"] = "es-HN";
  ISO639CodeEnum2["ES_IC"] = "es-IC";
  ISO639CodeEnum2["ES_MX"] = "es-MX";
  ISO639CodeEnum2["ES_NI"] = "es-NI";
  ISO639CodeEnum2["ES_PA"] = "es-PA";
  ISO639CodeEnum2["ES_PE"] = "es-PE";
  ISO639CodeEnum2["ES_PH"] = "es-PH";
  ISO639CodeEnum2["ES_PR"] = "es-PR";
  ISO639CodeEnum2["ES_PY"] = "es-PY";
  ISO639CodeEnum2["ES_SV"] = "es-SV";
  ISO639CodeEnum2["ES_US"] = "es-US";
  ISO639CodeEnum2["ES_UY"] = "es-UY";
  ISO639CodeEnum2["ES_VE"] = "es-VE";
  ISO639CodeEnum2["ET"] = "et";
  ISO639CodeEnum2["ET_EE"] = "et-EE";
  ISO639CodeEnum2["EU"] = "eu";
  ISO639CodeEnum2["EU_ES"] = "eu-ES";
  ISO639CodeEnum2["EWO"] = "ewo";
  ISO639CodeEnum2["EWO_CM"] = "ewo-CM";
  ISO639CodeEnum2["FA"] = "fa";
  ISO639CodeEnum2["FA_AF"] = "fa-AF";
  ISO639CodeEnum2["FA_IR"] = "fa-IR";
  ISO639CodeEnum2["FF"] = "ff";
  ISO639CodeEnum2["FF_BF"] = "ff-BF";
  ISO639CodeEnum2["FF_CM"] = "ff-CM";
  ISO639CodeEnum2["FF_GH"] = "ff-GH";
  ISO639CodeEnum2["FF_GM"] = "ff-GM";
  ISO639CodeEnum2["FF_GN"] = "ff-GN";
  ISO639CodeEnum2["FF_GW"] = "ff-GW";
  ISO639CodeEnum2["FF_LR"] = "ff-LR";
  ISO639CodeEnum2["FF_MR"] = "ff-MR";
  ISO639CodeEnum2["FF_NE"] = "ff-NE";
  ISO639CodeEnum2["FF_NG"] = "ff-NG";
  ISO639CodeEnum2["FF_SL"] = "ff-SL";
  ISO639CodeEnum2["FF_SN"] = "ff-SN";
  ISO639CodeEnum2["FI"] = "fi";
  ISO639CodeEnum2["FIL"] = "fil";
  ISO639CodeEnum2["FIL_PH"] = "fil-PH";
  ISO639CodeEnum2["FI_FI"] = "fi-FI";
  ISO639CodeEnum2["FO"] = "fo";
  ISO639CodeEnum2["FO_DK"] = "fo-DK";
  ISO639CodeEnum2["FO_FO"] = "fo-FO";
  ISO639CodeEnum2["FR"] = "fr";
  ISO639CodeEnum2["FRR"] = "frr";
  ISO639CodeEnum2["FRR_DE"] = "frr-DE";
  ISO639CodeEnum2["FR_BE"] = "fr-BE";
  ISO639CodeEnum2["FR_BF"] = "fr-BF";
  ISO639CodeEnum2["FR_BI"] = "fr-BI";
  ISO639CodeEnum2["FR_BJ"] = "fr-BJ";
  ISO639CodeEnum2["FR_BL"] = "fr-BL";
  ISO639CodeEnum2["FR_CA"] = "fr-CA";
  ISO639CodeEnum2["FR_CD"] = "fr-CD";
  ISO639CodeEnum2["FR_CF"] = "fr-CF";
  ISO639CodeEnum2["FR_CG"] = "fr-CG";
  ISO639CodeEnum2["FR_CH"] = "fr-CH";
  ISO639CodeEnum2["FR_CI"] = "fr-CI";
  ISO639CodeEnum2["FR_CM"] = "fr-CM";
  ISO639CodeEnum2["FR_DJ"] = "fr-DJ";
  ISO639CodeEnum2["FR_DZ"] = "fr-DZ";
  ISO639CodeEnum2["FR_FR"] = "fr-FR";
  ISO639CodeEnum2["FR_GA"] = "fr-GA";
  ISO639CodeEnum2["FR_GF"] = "fr-GF";
  ISO639CodeEnum2["FR_GN"] = "fr-GN";
  ISO639CodeEnum2["FR_GP"] = "fr-GP";
  ISO639CodeEnum2["FR_GQ"] = "fr-GQ";
  ISO639CodeEnum2["FR_HT"] = "fr-HT";
  ISO639CodeEnum2["FR_KM"] = "fr-KM";
  ISO639CodeEnum2["FR_LU"] = "fr-LU";
  ISO639CodeEnum2["FR_MA"] = "fr-MA";
  ISO639CodeEnum2["FR_MC"] = "fr-MC";
  ISO639CodeEnum2["FR_MF"] = "fr-MF";
  ISO639CodeEnum2["FR_MG"] = "fr-MG";
  ISO639CodeEnum2["FR_ML"] = "fr-ML";
  ISO639CodeEnum2["FR_MQ"] = "fr-MQ";
  ISO639CodeEnum2["FR_MR"] = "fr-MR";
  ISO639CodeEnum2["FR_MU"] = "fr-MU";
  ISO639CodeEnum2["FR_NC"] = "fr-NC";
  ISO639CodeEnum2["FR_NE"] = "fr-NE";
  ISO639CodeEnum2["FR_PF"] = "fr-PF";
  ISO639CodeEnum2["FR_PM"] = "fr-PM";
  ISO639CodeEnum2["FR_RE"] = "fr-RE";
  ISO639CodeEnum2["FR_RW"] = "fr-RW";
  ISO639CodeEnum2["FR_SC"] = "fr-SC";
  ISO639CodeEnum2["FR_SN"] = "fr-SN";
  ISO639CodeEnum2["FR_SY"] = "fr-SY";
  ISO639CodeEnum2["FR_TD"] = "fr-TD";
  ISO639CodeEnum2["FR_TG"] = "fr-TG";
  ISO639CodeEnum2["FR_TN"] = "fr-TN";
  ISO639CodeEnum2["FR_VU"] = "fr-VU";
  ISO639CodeEnum2["FR_WF"] = "fr-WF";
  ISO639CodeEnum2["FR_YT"] = "fr-YT";
  ISO639CodeEnum2["FUR"] = "fur";
  ISO639CodeEnum2["FUR_IT"] = "fur-IT";
  ISO639CodeEnum2["FY"] = "fy";
  ISO639CodeEnum2["FY_NL"] = "fy-NL";
  ISO639CodeEnum2["GA"] = "ga";
  ISO639CodeEnum2["GA_GB"] = "ga-GB";
  ISO639CodeEnum2["GA_IE"] = "ga-IE";
  ISO639CodeEnum2["GD"] = "gd";
  ISO639CodeEnum2["GD_GB"] = "gd-GB";
  ISO639CodeEnum2["GL"] = "gl";
  ISO639CodeEnum2["GL_ES"] = "gl-ES";
  ISO639CodeEnum2["GSW"] = "gsw";
  ISO639CodeEnum2["GSW_CH"] = "gsw-CH";
  ISO639CodeEnum2["GSW_FR"] = "gsw-FR";
  ISO639CodeEnum2["GSW_LI"] = "gsw-LI";
  ISO639CodeEnum2["GU"] = "gu";
  ISO639CodeEnum2["GUZ"] = "guz";
  ISO639CodeEnum2["GUZ_KE"] = "guz-KE";
  ISO639CodeEnum2["GU_IN"] = "gu-IN";
  ISO639CodeEnum2["GV"] = "gv";
  ISO639CodeEnum2["GV_IM"] = "gv-IM";
  ISO639CodeEnum2["HA"] = "ha";
  ISO639CodeEnum2["HAW"] = "haw";
  ISO639CodeEnum2["HAW_US"] = "haw-US";
  ISO639CodeEnum2["HA_GH"] = "ha-GH";
  ISO639CodeEnum2["HA_NE"] = "ha-NE";
  ISO639CodeEnum2["HA_NG"] = "ha-NG";
  ISO639CodeEnum2["HE"] = "he";
  ISO639CodeEnum2["HI"] = "hi";
  ISO639CodeEnum2["HI_IN"] = "hi-IN";
  ISO639CodeEnum2["HR"] = "hr";
  ISO639CodeEnum2["HR_BA"] = "hr-BA";
  ISO639CodeEnum2["HR_HR"] = "hr-HR";
  ISO639CodeEnum2["HSB"] = "hsb";
  ISO639CodeEnum2["HSB_DE"] = "hsb-DE";
  ISO639CodeEnum2["HU"] = "hu";
  ISO639CodeEnum2["HU_HU"] = "hu-HU";
  ISO639CodeEnum2["HY"] = "hy";
  ISO639CodeEnum2["HY_AM"] = "hy-AM";
  ISO639CodeEnum2["IA"] = "ia";
  ISO639CodeEnum2["IA_001"] = "ia-001";
  ISO639CodeEnum2["ID"] = "id";
  ISO639CodeEnum2["IG"] = "ig";
  ISO639CodeEnum2["IG_NG"] = "ig-NG";
  ISO639CodeEnum2["II"] = "ii";
  ISO639CodeEnum2["II_CN"] = "ii-CN";
  ISO639CodeEnum2["IN_ID"] = "in-ID";
  ISO639CodeEnum2["IS"] = "is";
  ISO639CodeEnum2["IS_IS"] = "is-IS";
  ISO639CodeEnum2["IT"] = "it";
  ISO639CodeEnum2["IT_CH"] = "it-CH";
  ISO639CodeEnum2["IT_IT"] = "it-IT";
  ISO639CodeEnum2["IT_SM"] = "it-SM";
  ISO639CodeEnum2["IT_VA"] = "it-VA";
  ISO639CodeEnum2["IW_IL"] = "iw-IL";
  ISO639CodeEnum2["JA"] = "ja";
  ISO639CodeEnum2["JA_JP"] = "ja-JP";
  ISO639CodeEnum2["JGO"] = "jgo";
  ISO639CodeEnum2["JGO_CM"] = "jgo-CM";
  ISO639CodeEnum2["JI"] = "ji";
  ISO639CodeEnum2["JI_001"] = "ji-001";
  ISO639CodeEnum2["JMC"] = "jmc";
  ISO639CodeEnum2["JMC_TZ"] = "jmc-TZ";
  ISO639CodeEnum2["JV"] = "jv";
  ISO639CodeEnum2["JV_ID"] = "jv-ID";
  ISO639CodeEnum2["KA"] = "ka";
  ISO639CodeEnum2["KAB"] = "kab";
  ISO639CodeEnum2["KAB_DZ"] = "kab-DZ";
  ISO639CodeEnum2["KAM"] = "kam";
  ISO639CodeEnum2["KAM_KE"] = "kam-KE";
  ISO639CodeEnum2["KA_GE"] = "ka-GE";
  ISO639CodeEnum2["KDE"] = "kde";
  ISO639CodeEnum2["KDE_TZ"] = "kde-TZ";
  ISO639CodeEnum2["KEA"] = "kea";
  ISO639CodeEnum2["KEA_CV"] = "kea-CV";
  ISO639CodeEnum2["KGP"] = "kgp";
  ISO639CodeEnum2["KGP_BR"] = "kgp-BR";
  ISO639CodeEnum2["KHQ"] = "khq";
  ISO639CodeEnum2["KHQ_ML"] = "khq-ML";
  ISO639CodeEnum2["KI"] = "ki";
  ISO639CodeEnum2["KI_KE"] = "ki-KE";
  ISO639CodeEnum2["KK"] = "kk";
  ISO639CodeEnum2["KKJ"] = "kkj";
  ISO639CodeEnum2["KKJ_CM"] = "kkj-CM";
  ISO639CodeEnum2["KK_KZ"] = "kk-KZ";
  ISO639CodeEnum2["KL"] = "kl";
  ISO639CodeEnum2["KLN"] = "kln";
  ISO639CodeEnum2["KLN_KE"] = "kln-KE";
  ISO639CodeEnum2["KL_GL"] = "kl-GL";
  ISO639CodeEnum2["KM"] = "km";
  ISO639CodeEnum2["KM_KH"] = "km-KH";
  ISO639CodeEnum2["KN"] = "kn";
  ISO639CodeEnum2["KN_IN"] = "kn-IN";
  ISO639CodeEnum2["KO"] = "ko";
  ISO639CodeEnum2["KOK"] = "kok";
  ISO639CodeEnum2["KOK_IN"] = "kok-IN";
  ISO639CodeEnum2["KO_KP"] = "ko-KP";
  ISO639CodeEnum2["KO_KR"] = "ko-KR";
  ISO639CodeEnum2["KS"] = "ks";
  ISO639CodeEnum2["KSB"] = "ksb";
  ISO639CodeEnum2["KSB_TZ"] = "ksb-TZ";
  ISO639CodeEnum2["KSF"] = "ksf";
  ISO639CodeEnum2["KSF_CM"] = "ksf-CM";
  ISO639CodeEnum2["KSH"] = "ksh";
  ISO639CodeEnum2["KSH_DE"] = "ksh-DE";
  ISO639CodeEnum2["KS_IN"] = "ks-IN";
  ISO639CodeEnum2["KU"] = "ku";
  ISO639CodeEnum2["KU_TR"] = "ku-TR";
  ISO639CodeEnum2["KW"] = "kw";
  ISO639CodeEnum2["KW_GB"] = "kw-GB";
  ISO639CodeEnum2["KY"] = "ky";
  ISO639CodeEnum2["KY_KG"] = "ky-KG";
  ISO639CodeEnum2["LAG"] = "lag";
  ISO639CodeEnum2["LAG_TZ"] = "lag-TZ";
  ISO639CodeEnum2["LB"] = "lb";
  ISO639CodeEnum2["LB_LU"] = "lb-LU";
  ISO639CodeEnum2["LG"] = "lg";
  ISO639CodeEnum2["LG_UG"] = "lg-UG";
  ISO639CodeEnum2["LKT"] = "lkt";
  ISO639CodeEnum2["LKT_US"] = "lkt-US";
  ISO639CodeEnum2["LN"] = "ln";
  ISO639CodeEnum2["LN_AO"] = "ln-AO";
  ISO639CodeEnum2["LN_CD"] = "ln-CD";
  ISO639CodeEnum2["LN_CF"] = "ln-CF";
  ISO639CodeEnum2["LN_CG"] = "ln-CG";
  ISO639CodeEnum2["LO"] = "lo";
  ISO639CodeEnum2["LO_LA"] = "lo-LA";
  ISO639CodeEnum2["LRC"] = "lrc";
  ISO639CodeEnum2["LRC_IQ"] = "lrc-IQ";
  ISO639CodeEnum2["LRC_IR"] = "lrc-IR";
  ISO639CodeEnum2["LT"] = "lt";
  ISO639CodeEnum2["LT_LT"] = "lt-LT";
  ISO639CodeEnum2["LU"] = "lu";
  ISO639CodeEnum2["LUO"] = "luo";
  ISO639CodeEnum2["LUO_KE"] = "luo-KE";
  ISO639CodeEnum2["LUY"] = "luy";
  ISO639CodeEnum2["LUY_KE"] = "luy-KE";
  ISO639CodeEnum2["LU_CD"] = "lu-CD";
  ISO639CodeEnum2["LV"] = "lv";
  ISO639CodeEnum2["LV_LV"] = "lv-LV";
  ISO639CodeEnum2["MAI"] = "mai";
  ISO639CodeEnum2["MAI_IN"] = "mai-IN";
  ISO639CodeEnum2["MAS"] = "mas";
  ISO639CodeEnum2["MAS_KE"] = "mas-KE";
  ISO639CodeEnum2["MAS_TZ"] = "mas-TZ";
  ISO639CodeEnum2["MDF"] = "mdf";
  ISO639CodeEnum2["MDF_RU"] = "mdf-RU";
  ISO639CodeEnum2["MER"] = "mer";
  ISO639CodeEnum2["MER_KE"] = "mer-KE";
  ISO639CodeEnum2["MFE"] = "mfe";
  ISO639CodeEnum2["MFE_MU"] = "mfe-MU";
  ISO639CodeEnum2["MG"] = "mg";
  ISO639CodeEnum2["MGH"] = "mgh";
  ISO639CodeEnum2["MGH_MZ"] = "mgh-MZ";
  ISO639CodeEnum2["MGO"] = "mgo";
  ISO639CodeEnum2["MGO_CM"] = "mgo-CM";
  ISO639CodeEnum2["MG_MG"] = "mg-MG";
  ISO639CodeEnum2["MI"] = "mi";
  ISO639CodeEnum2["MI_NZ"] = "mi-NZ";
  ISO639CodeEnum2["MK"] = "mk";
  ISO639CodeEnum2["MK_MK"] = "mk-MK";
  ISO639CodeEnum2["ML"] = "ml";
  ISO639CodeEnum2["ML_IN"] = "ml-IN";
  ISO639CodeEnum2["MN"] = "mn";
  ISO639CodeEnum2["MNI"] = "mni";
  ISO639CodeEnum2["MNI_IN"] = "mni-IN";
  ISO639CodeEnum2["MN_MN"] = "mn-MN";
  ISO639CodeEnum2["MR"] = "mr";
  ISO639CodeEnum2["MR_IN"] = "mr-IN";
  ISO639CodeEnum2["MS"] = "ms";
  ISO639CodeEnum2["MS_BN"] = "ms-BN";
  ISO639CodeEnum2["MS_ID"] = "ms-ID";
  ISO639CodeEnum2["MS_MY"] = "ms-MY";
  ISO639CodeEnum2["MS_SG"] = "ms-SG";
  ISO639CodeEnum2["MT"] = "mt";
  ISO639CodeEnum2["MT_MT"] = "mt-MT";
  ISO639CodeEnum2["MUA"] = "mua";
  ISO639CodeEnum2["MUA_CM"] = "mua-CM";
  ISO639CodeEnum2["MY"] = "my";
  ISO639CodeEnum2["MY_MM"] = "my-MM";
  ISO639CodeEnum2["MZN"] = "mzn";
  ISO639CodeEnum2["MZN_IR"] = "mzn-IR";
  ISO639CodeEnum2["NAQ"] = "naq";
  ISO639CodeEnum2["NAQ_NA"] = "naq-NA";
  ISO639CodeEnum2["NB"] = "nb";
  ISO639CodeEnum2["NB_NO"] = "nb-NO";
  ISO639CodeEnum2["NB_SJ"] = "nb-SJ";
  ISO639CodeEnum2["ND"] = "nd";
  ISO639CodeEnum2["NDS"] = "nds";
  ISO639CodeEnum2["NDS_DE"] = "nds-DE";
  ISO639CodeEnum2["NDS_NL"] = "nds-NL";
  ISO639CodeEnum2["ND_ZW"] = "nd-ZW";
  ISO639CodeEnum2["NE"] = "ne";
  ISO639CodeEnum2["NE_IN"] = "ne-IN";
  ISO639CodeEnum2["NE_NP"] = "ne-NP";
  ISO639CodeEnum2["NL"] = "nl";
  ISO639CodeEnum2["NL_AW"] = "nl-AW";
  ISO639CodeEnum2["NL_BE"] = "nl-BE";
  ISO639CodeEnum2["NL_BQ"] = "nl-BQ";
  ISO639CodeEnum2["NL_CH"] = "nl-CH";
  ISO639CodeEnum2["NL_CW"] = "nl-CW";
  ISO639CodeEnum2["NL_LU"] = "nl-LU";
  ISO639CodeEnum2["NL_NL"] = "nl-NL";
  ISO639CodeEnum2["NL_SR"] = "nl-SR";
  ISO639CodeEnum2["NL_SX"] = "nl-SX";
  ISO639CodeEnum2["NMG"] = "nmg";
  ISO639CodeEnum2["NMG_CM"] = "nmg-CM";
  ISO639CodeEnum2["NN"] = "nn";
  ISO639CodeEnum2["NNH"] = "nnh";
  ISO639CodeEnum2["NNH_CM"] = "nnh-CM";
  ISO639CodeEnum2["NN_NO"] = "nn-NO";
  ISO639CodeEnum2["NO"] = "no";
  ISO639CodeEnum2["NO_NO"] = "no-NO";
  ISO639CodeEnum2["NUS"] = "nus";
  ISO639CodeEnum2["NUS_SS"] = "nus-SS";
  ISO639CodeEnum2["NYN"] = "nyn";
  ISO639CodeEnum2["NYN_UG"] = "nyn-UG";
  ISO639CodeEnum2["OC"] = "oc";
  ISO639CodeEnum2["OC_ES"] = "oc-ES";
  ISO639CodeEnum2["OC_FR"] = "oc-FR";
  ISO639CodeEnum2["OM"] = "om";
  ISO639CodeEnum2["OM_ET"] = "om-ET";
  ISO639CodeEnum2["OM_KE"] = "om-KE";
  ISO639CodeEnum2["OR"] = "or";
  ISO639CodeEnum2["OR_IN"] = "or-IN";
  ISO639CodeEnum2["OS"] = "os";
  ISO639CodeEnum2["OS_GE"] = "os-GE";
  ISO639CodeEnum2["OS_RU"] = "os-RU";
  ISO639CodeEnum2["PA"] = "pa";
  ISO639CodeEnum2["PA_IN"] = "pa-IN";
  ISO639CodeEnum2["PA_PK"] = "pa-PK";
  ISO639CodeEnum2["PCM"] = "pcm";
  ISO639CodeEnum2["PCM_NG"] = "pcm-NG";
  ISO639CodeEnum2["PIS"] = "pis";
  ISO639CodeEnum2["PIS_SB"] = "pis-SB";
  ISO639CodeEnum2["PL"] = "pl";
  ISO639CodeEnum2["PL_PL"] = "pl-PL";
  ISO639CodeEnum2["PRG"] = "prg";
  ISO639CodeEnum2["PRG_001"] = "prg-001";
  ISO639CodeEnum2["PS"] = "ps";
  ISO639CodeEnum2["PS_AF"] = "ps-AF";
  ISO639CodeEnum2["PS_PK"] = "ps-PK";
  ISO639CodeEnum2["PT"] = "pt";
  ISO639CodeEnum2["PT_AO"] = "pt-AO";
  ISO639CodeEnum2["PT_BR"] = "pt-BR";
  ISO639CodeEnum2["PT_CH"] = "pt-CH";
  ISO639CodeEnum2["PT_CV"] = "pt-CV";
  ISO639CodeEnum2["PT_GQ"] = "pt-GQ";
  ISO639CodeEnum2["PT_GW"] = "pt-GW";
  ISO639CodeEnum2["PT_LU"] = "pt-LU";
  ISO639CodeEnum2["PT_MO"] = "pt-MO";
  ISO639CodeEnum2["PT_MZ"] = "pt-MZ";
  ISO639CodeEnum2["PT_PT"] = "pt-PT";
  ISO639CodeEnum2["PT_ST"] = "pt-ST";
  ISO639CodeEnum2["PT_TL"] = "pt-TL";
  ISO639CodeEnum2["QU"] = "qu";
  ISO639CodeEnum2["QU_BO"] = "qu-BO";
  ISO639CodeEnum2["QU_EC"] = "qu-EC";
  ISO639CodeEnum2["QU_PE"] = "qu-PE";
  ISO639CodeEnum2["RAJ"] = "raj";
  ISO639CodeEnum2["RAJ_IN"] = "raj-IN";
  ISO639CodeEnum2["RM"] = "rm";
  ISO639CodeEnum2["RM_CH"] = "rm-CH";
  ISO639CodeEnum2["RN"] = "rn";
  ISO639CodeEnum2["RN_BI"] = "rn-BI";
  ISO639CodeEnum2["RO"] = "ro";
  ISO639CodeEnum2["ROF"] = "rof";
  ISO639CodeEnum2["ROF_TZ"] = "rof-TZ";
  ISO639CodeEnum2["RO_MD"] = "ro-MD";
  ISO639CodeEnum2["RO_RO"] = "ro-RO";
  ISO639CodeEnum2["RU"] = "ru";
  ISO639CodeEnum2["RU_BY"] = "ru-BY";
  ISO639CodeEnum2["RU_KG"] = "ru-KG";
  ISO639CodeEnum2["RU_KZ"] = "ru-KZ";
  ISO639CodeEnum2["RU_MD"] = "ru-MD";
  ISO639CodeEnum2["RU_RU"] = "ru-RU";
  ISO639CodeEnum2["RU_UA"] = "ru-UA";
  ISO639CodeEnum2["RW"] = "rw";
  ISO639CodeEnum2["RWK"] = "rwk";
  ISO639CodeEnum2["RWK_TZ"] = "rwk-TZ";
  ISO639CodeEnum2["RW_RW"] = "rw-RW";
  ISO639CodeEnum2["SA"] = "sa";
  ISO639CodeEnum2["SAH"] = "sah";
  ISO639CodeEnum2["SAH_RU"] = "sah-RU";
  ISO639CodeEnum2["SAQ"] = "saq";
  ISO639CodeEnum2["SAQ_KE"] = "saq-KE";
  ISO639CodeEnum2["SAT"] = "sat";
  ISO639CodeEnum2["SAT_IN"] = "sat-IN";
  ISO639CodeEnum2["SA_IN"] = "sa-IN";
  ISO639CodeEnum2["SBP"] = "sbp";
  ISO639CodeEnum2["SBP_TZ"] = "sbp-TZ";
  ISO639CodeEnum2["SC"] = "sc";
  ISO639CodeEnum2["SC_IT"] = "sc-IT";
  ISO639CodeEnum2["SD"] = "sd";
  ISO639CodeEnum2["SD_IN"] = "sd-IN";
  ISO639CodeEnum2["SD_PK"] = "sd-PK";
  ISO639CodeEnum2["SE"] = "se";
  ISO639CodeEnum2["SEH"] = "seh";
  ISO639CodeEnum2["SEH_MZ"] = "seh-MZ";
  ISO639CodeEnum2["SES"] = "ses";
  ISO639CodeEnum2["SES_ML"] = "ses-ML";
  ISO639CodeEnum2["SE_FI"] = "se-FI";
  ISO639CodeEnum2["SE_NO"] = "se-NO";
  ISO639CodeEnum2["SE_SE"] = "se-SE";
  ISO639CodeEnum2["SG"] = "sg";
  ISO639CodeEnum2["SG_CF"] = "sg-CF";
  ISO639CodeEnum2["SHI"] = "shi";
  ISO639CodeEnum2["SHI_MA"] = "shi-MA";
  ISO639CodeEnum2["SI"] = "si";
  ISO639CodeEnum2["SI_LK"] = "si-LK";
  ISO639CodeEnum2["SK"] = "sk";
  ISO639CodeEnum2["SK_SK"] = "sk-SK";
  ISO639CodeEnum2["SL"] = "sl";
  ISO639CodeEnum2["SL_SI"] = "sl-SI";
  ISO639CodeEnum2["SMN"] = "smn";
  ISO639CodeEnum2["SMN_FI"] = "smn-FI";
  ISO639CodeEnum2["SMS"] = "sms";
  ISO639CodeEnum2["SMS_FI"] = "sms-FI";
  ISO639CodeEnum2["SN"] = "sn";
  ISO639CodeEnum2["SN_ZW"] = "sn-ZW";
  ISO639CodeEnum2["SO"] = "so";
  ISO639CodeEnum2["SO_DJ"] = "so-DJ";
  ISO639CodeEnum2["SO_ET"] = "so-ET";
  ISO639CodeEnum2["SO_KE"] = "so-KE";
  ISO639CodeEnum2["SO_SO"] = "so-SO";
  ISO639CodeEnum2["SQ"] = "sq";
  ISO639CodeEnum2["SQ_AL"] = "sq-AL";
  ISO639CodeEnum2["SQ_MK"] = "sq-MK";
  ISO639CodeEnum2["SQ_XK"] = "sq-XK";
  ISO639CodeEnum2["SR"] = "sr";
  ISO639CodeEnum2["SR_BA"] = "sr-BA";
  ISO639CodeEnum2["SR_CS"] = "sr-CS";
  ISO639CodeEnum2["SR_ME"] = "sr-ME";
  ISO639CodeEnum2["SR_RS"] = "sr-RS";
  ISO639CodeEnum2["SR_XK"] = "sr-XK";
  ISO639CodeEnum2["SU"] = "su";
  ISO639CodeEnum2["SU_ID"] = "su-ID";
  ISO639CodeEnum2["SV"] = "sv";
  ISO639CodeEnum2["SV_AX"] = "sv-AX";
  ISO639CodeEnum2["SV_FI"] = "sv-FI";
  ISO639CodeEnum2["SV_SE"] = "sv-SE";
  ISO639CodeEnum2["SW"] = "sw";
  ISO639CodeEnum2["SW_CD"] = "sw-CD";
  ISO639CodeEnum2["SW_KE"] = "sw-KE";
  ISO639CodeEnum2["SW_TZ"] = "sw-TZ";
  ISO639CodeEnum2["SW_UG"] = "sw-UG";
  ISO639CodeEnum2["SY"] = "sy";
  ISO639CodeEnum2["TA"] = "ta";
  ISO639CodeEnum2["TA_IN"] = "ta-IN";
  ISO639CodeEnum2["TA_LK"] = "ta-LK";
  ISO639CodeEnum2["TA_MY"] = "ta-MY";
  ISO639CodeEnum2["TA_SG"] = "ta-SG";
  ISO639CodeEnum2["TE"] = "te";
  ISO639CodeEnum2["TEO"] = "teo";
  ISO639CodeEnum2["TEO_KE"] = "teo-KE";
  ISO639CodeEnum2["TEO_UG"] = "teo-UG";
  ISO639CodeEnum2["TE_IN"] = "te-IN";
  ISO639CodeEnum2["TG"] = "tg";
  ISO639CodeEnum2["TG_TJ"] = "tg-TJ";
  ISO639CodeEnum2["TH"] = "th";
  ISO639CodeEnum2["TH_TH"] = "th-TH";
  ISO639CodeEnum2["TI"] = "ti";
  ISO639CodeEnum2["TI_ER"] = "ti-ER";
  ISO639CodeEnum2["TI_ET"] = "ti-ET";
  ISO639CodeEnum2["TK"] = "tk";
  ISO639CodeEnum2["TK_TM"] = "tk-TM";
  ISO639CodeEnum2["TL"] = "tl";
  ISO639CodeEnum2["TO"] = "to";
  ISO639CodeEnum2["TOK"] = "tok";
  ISO639CodeEnum2["TOK_001"] = "tok-001";
  ISO639CodeEnum2["TO_TO"] = "to-TO";
  ISO639CodeEnum2["TR"] = "tr";
  ISO639CodeEnum2["TR_CY"] = "tr-CY";
  ISO639CodeEnum2["TR_TR"] = "tr-TR";
  ISO639CodeEnum2["TT"] = "tt";
  ISO639CodeEnum2["TT_RU"] = "tt-RU";
  ISO639CodeEnum2["TWQ"] = "twq";
  ISO639CodeEnum2["TWQ_NE"] = "twq-NE";
  ISO639CodeEnum2["TZM"] = "tzm";
  ISO639CodeEnum2["TZM_MA"] = "tzm-MA";
  ISO639CodeEnum2["UG"] = "ug";
  ISO639CodeEnum2["UG_CN"] = "ug-CN";
  ISO639CodeEnum2["UK"] = "uk";
  ISO639CodeEnum2["UK_UA"] = "uk-UA";
  ISO639CodeEnum2["UR"] = "ur";
  ISO639CodeEnum2["UR_IN"] = "ur-IN";
  ISO639CodeEnum2["UR_PK"] = "ur-PK";
  ISO639CodeEnum2["UZ"] = "uz";
  ISO639CodeEnum2["UZ_AF"] = "uz-AF";
  ISO639CodeEnum2["UZ_UZ"] = "uz-UZ";
  ISO639CodeEnum2["VAI"] = "vai";
  ISO639CodeEnum2["VAI_LR"] = "vai-LR";
  ISO639CodeEnum2["VI"] = "vi";
  ISO639CodeEnum2["VI_VN"] = "vi-VN";
  ISO639CodeEnum2["VO"] = "vo";
  ISO639CodeEnum2["VO_001"] = "vo-001";
  ISO639CodeEnum2["VUN"] = "vun";
  ISO639CodeEnum2["VUN_TZ"] = "vun-TZ";
  ISO639CodeEnum2["WAE"] = "wae";
  ISO639CodeEnum2["WAE_CH"] = "wae-CH";
  ISO639CodeEnum2["WO"] = "wo";
  ISO639CodeEnum2["WO_SN"] = "wo-SN";
  ISO639CodeEnum2["XH"] = "xh";
  ISO639CodeEnum2["XH_ZA"] = "xh-ZA";
  ISO639CodeEnum2["XOG"] = "xog";
  ISO639CodeEnum2["XOG_UG"] = "xog-UG";
  ISO639CodeEnum2["YAV"] = "yav";
  ISO639CodeEnum2["YAV_CM"] = "yav-CM";
  ISO639CodeEnum2["YO"] = "yo";
  ISO639CodeEnum2["YO_BJ"] = "yo-BJ";
  ISO639CodeEnum2["YO_NG"] = "yo-NG";
  ISO639CodeEnum2["YRL"] = "yrl";
  ISO639CodeEnum2["YRL_BR"] = "yrl-BR";
  ISO639CodeEnum2["YRL_CO"] = "yrl-CO";
  ISO639CodeEnum2["YRL_VE"] = "yrl-VE";
  ISO639CodeEnum2["YUE"] = "yue";
  ISO639CodeEnum2["YUE_CN"] = "yue-CN";
  ISO639CodeEnum2["YUE_HK"] = "yue-HK";
  ISO639CodeEnum2["ZGH"] = "zgh";
  ISO639CodeEnum2["ZGH_MA"] = "zgh-MA";
  ISO639CodeEnum2["ZH"] = "zh";
  ISO639CodeEnum2["ZH_CN"] = "zh-CN";
  ISO639CodeEnum2["ZH_HANS"] = "zh-Hans";
  ISO639CodeEnum2["ZH_HANT"] = "zh-Hant";
  ISO639CodeEnum2["ZH_HK"] = "zh-HK";
  ISO639CodeEnum2["ZH_MO"] = "zh-MO";
  ISO639CodeEnum2["ZH_SG"] = "zh-SG";
  ISO639CodeEnum2["ZH_TW"] = "zh-TW";
  ISO639CodeEnum2["ZU"] = "zu";
  ISO639CodeEnum2["ZU_ZA"] = "zu-ZA";
  return ISO639CodeEnum2;
})(ISO639CodeEnum || {});
function useAvailableTranslations() {
  var _a;
  const renderContext = useRenderContext();
  const availableTranslationsResult = (_a = renderContext.resolvedDataDependencies) == null ? void 0 : _a.availableTranslations;
  if ((availableTranslationsResult == null ? void 0 : availableTranslationsResult.type) === "success") {
    return availableTranslationsResult.data;
  }
  if ((availableTranslationsResult == null ? void 0 : availableTranslationsResult.type) === "error") {
    const errorMessage = availableTranslationsResult.error;
    logWarn(errorMessage);
  }
  return {};
}

// src/hooks/useLanguageVariants.tsx
function useLanguageVariants() {
  var _a;
  const renderContext = useRenderContext();
  const languageVariantsResult = (_a = renderContext.resolvedDataDependencies) == null ? void 0 : _a.languageVariants;
  if ((languageVariantsResult == null ? void 0 : languageVariantsResult.status) === "SUCCESS") {
    return languageVariantsResult.data;
  }
  if ((languageVariantsResult == null ? void 0 : languageVariantsResult.status) === "ERROR") {
    logError(languageVariantsResult.error);
  }
  if ((languageVariantsResult == null ? void 0 : languageVariantsResult.status) === "WARNING") {
    logWarn(languageVariantsResult.warning);
  }
  return [];
}

// src/hooks/unstable_useVideos.tsx
function unstable_useVideos(resolvableIds) {
  var _a;
  const renderContext = useRenderContext();
  const uniqueId = `${resolvableIds.type}:${resolvableIds.value}`;
  if (!((_a = renderContext.resolvedDataDependencies) == null ? void 0 : _a.videos)) {
    return [];
  }
  const videoDependencies = renderContext.resolvedDataDependencies.videos;
  const videoDependency = videoDependencies.dependencies[uniqueId];
  if (!videoDependency) {
    return null;
  }
  if (videoDependency.status === "success") {
    const videos = videoDependency.ids.map(
      (videoId) => videoDependencies.data[videoId]
    );
    return videos;
  }
  if (videoDependency.status === "error") {
    logWarn(videoDependency.error);
    return [];
  }
  return [];
}

// src/hooks/unstable_usePodcastShows.tsx
function unstable_usePodcastShows(resolvableIds) {
  var _a;
  const renderContext = useRenderContext();
  const uniqueId = `${resolvableIds.type}:${resolvableIds.value}`;
  if (!((_a = renderContext.resolvedDataDependencies) == null ? void 0 : _a.podcastShows)) {
    return [];
  }
  const podcastShowDependencies = renderContext.resolvedDataDependencies.podcastShows;
  const podcastDependency = podcastShowDependencies.dependencies[uniqueId];
  if (!podcastDependency)
    return null;
  if (podcastDependency.status === "success") {
    const shows = podcastDependency.ids.map(
      (showId) => podcastShowDependencies.data[showId]
    );
    return shows;
  }
  if (podcastDependency.status === "error") {
    logWarn(podcastDependency.error);
    return [];
  }
  return [];
}

// src/hooks/unstable_usePodcastEpisodes.tsx
function unstable_usePodcastEpisodes(resolvableIds) {
  var _a;
  const renderContext = useRenderContext();
  const resolvedIdType = resolvableIds.type === "id" ? "ID" : "FIELD_PATH";
  const uniqueId = `${resolvedIdType}:${resolvableIds.value}`;
  if (!((_a = renderContext.resolvedDataDependencies) == null ? void 0 : _a.podcastEpisodes)) {
    return [];
  }
  const podcastEpisodeDependencies = renderContext.resolvedDataDependencies.podcastEpisodes;
  const podcastDependency = podcastEpisodeDependencies.dependencies[uniqueId];
  if (!podcastDependency)
    return null;
  if (podcastDependency.status === "success") {
    const episodes = podcastDependency.ids.map(
      (episodeId) => podcastEpisodeDependencies.data[episodeId]
    );
    return episodes;
  }
  if (podcastDependency.status === "error") {
    logWarn(podcastDependency.error);
    return [];
  }
  return [];
}

// src/hooks/useMenu.tsx
function useMenu(resolvableIds) {
  var _a;
  const renderContext = useRenderContext();
  const resolvedIdType = resolvableIds.type === "id" ? "ID" : "FIELD_PATH";
  const uniqueId = `${resolvedIdType}:${resolvableIds.value}`;
  if (!((_a = renderContext.resolvedDataDependencies) == null ? void 0 : _a.menus)) {
    return null;
  }
  const menuDependencies = renderContext.resolvedDataDependencies.menus;
  const menuDependency = menuDependencies.dependencies[uniqueId];
  if (!menuDependency) {
    return null;
  }
  if (menuDependency.status === "success" && menuDependency.id) {
    const menu = menuDependencies.data[menuDependency.id];
    return menu || null;
  }
  if (menuDependency.status === "error") {
    logError(menuDependency.error);
  }
  return null;
}

// src/hooks/useEditorVariableChecks.tsx
function useEditorVariableChecks() {
  var _a;
  const renderContext = useRenderContext();
  const editorChecksResult = (_a = renderContext.resolvedDataDependencies) == null ? void 0 : _a.editorVariableChecks;
  if ((editorChecksResult == null ? void 0 : editorChecksResult.type) === "success" && editorChecksResult.data) {
    return editorChecksResult.data;
  }
  if ((editorChecksResult == null ? void 0 : editorChecksResult.type) === "error") {
    logError(
      editorChecksResult.error || "Failed to load editor variable checks"
    );
  }
  return {};
}

// src/hooks/useBrandSettings.tsx
function useBrandSettings() {
  var _a;
  const renderContext = useRenderContext();
  const brandSettingsResult = (_a = renderContext.resolvedDataDependencies) == null ? void 0 : _a.brandSettings;
  if ((brandSettingsResult == null ? void 0 : brandSettingsResult.type) === "success") {
    return brandSettingsResult.data;
  }
  if ((brandSettingsResult == null ? void 0 : brandSettingsResult.type) === "error") {
    logError(brandSettingsResult.error);
  }
  if ((brandSettingsResult == null ? void 0 : brandSettingsResult.type) === "deferred") {
    return null;
  }
  return null;
}

// src/hooks/tokens.tsx
function id(value) {
  return { type: "id", value };
}
function fieldPath(value) {
  return { type: "fieldPath", value };
}

// src/islands/SharedIslandState.tsx
import { jsx as jsx5 } from "react/jsx-runtime";
var stateUpdaterForReducer = (prevState, newValOrFunc) => {
  if (typeof newValOrFunc === "function") {
    return newValOrFunc(prevState);
  }
  return newValOrFunc;
};
function SharedIslandState({
  children,
  value,
  id: id2
}) {
  return /* @__PURE__ */ jsx5(
    SharedIslandReducer,
    {
      id: id2,
      value,
      customReducerFunc: stateUpdaterForReducer,
      children
    }
  );
}
function useSharedIslandState() {
  return useSharedIslandReducerInternal(stateUpdaterForReducer);
}

// src/config/secrets.ts
var secretMap;
function setSecrets(secrets) {
  if (!import.meta.env.SSR) {
    throw new Error("Secrets can only be initialized from the server");
  }
  secretMap = secrets;
}
function setSecretsFromEnv(secretNames) {
  if (!import.meta.env.SSR) {
    throw new Error("Secrets can only be initialized from the server");
  }
  const secretEntries = secretNames.map((name) => [name, import.meta.env[`HS_${name}`]]).filter(([__name, value]) => value !== void 0);
  setSecrets(new Map(secretEntries));
}
function getSecret(secretName) {
  if (!import.meta.env.SSR) {
    throw new Error(
      "Secrets can't be directly accessed from within islands to avoid leaking to the client. If you really want to use one in an island, access it from a parent component of the island and pass it as a prop."
    );
  }
  if (import.meta.env.DEV === true && import.meta.env.TEST !== "true" && import.meta.env.secretNames) {
    console.log("Dev server running, grabbing secrets from env");
    const secretNames = import.meta.env.secretNames;
    const secretEntries = secretNames.map((name) => [name, import.meta.env[`HS_${name}`]]).filter(([__name, value]) => value !== void 0);
    if (secretEntries.size === 0) {
      throw new Error("No secrets found in the environment");
    }
    if (secretMap === void 0) {
      setSecrets(new Map(secretEntries));
    }
  }
  if (!secretMap) {
    throw new Error("Secrets haven't been initialized");
  }
  if (!secretMap.has(secretName)) {
    throw new Error(
      `Secret ${secretName} isn't available in this context, make sure to include it in your cms-assets.json configuration and add it using \`hs secrets add\``
    );
  }
  return secretMap.get(secretName);
}

// src/components/RichTextFieldWrapper.tsx
import { jsx as jsx6 } from "react/jsx-runtime";
var DEFAULT_TAG = "div";
function RichTextFieldWrapper({
  fieldValue,
  tag: WrapperElement = DEFAULT_TAG,
  ...otherHTMLAttributes
}) {
  if (otherHTMLAttributes.children) {
    throw new Error(
      "Cannot pass children to RichTextFieldWrapper, only HTML field type values via `fieldValue"
    );
  }
  return /* @__PURE__ */ jsx6(
    WrapperElement,
    {
      dangerouslySetInnerHTML: { __html: fieldValue },
      ...otherHTMLAttributes
    }
  );
}

// src/components/Icon.tsx
import { useId as useId4 } from "react";

// node_modules/dot-prop/index.js
var isObject = (value) => {
  const type = typeof value;
  return value !== null && (type === "object" || type === "function");
};
var disallowedKeys = /* @__PURE__ */ new Set([
  "__proto__",
  "prototype",
  "constructor"
]);
var digits = new Set("0123456789");
function getPathSegments(path) {
  const parts = [];
  let currentSegment = "";
  let currentPart = "start";
  let isIgnoring = false;
  for (const character of path) {
    switch (character) {
      case "\\": {
        if (currentPart === "index") {
          throw new Error("Invalid character in an index");
        }
        if (currentPart === "indexEnd") {
          throw new Error("Invalid character after an index");
        }
        if (isIgnoring) {
          currentSegment += character;
        }
        currentPart = "property";
        isIgnoring = !isIgnoring;
        break;
      }
      case ".": {
        if (currentPart === "index") {
          throw new Error("Invalid character in an index");
        }
        if (currentPart === "indexEnd") {
          currentPart = "property";
          break;
        }
        if (isIgnoring) {
          isIgnoring = false;
          currentSegment += character;
          break;
        }
        if (disallowedKeys.has(currentSegment)) {
          return [];
        }
        parts.push(currentSegment);
        currentSegment = "";
        currentPart = "property";
        break;
      }
      case "[": {
        if (currentPart === "index") {
          throw new Error("Invalid character in an index");
        }
        if (currentPart === "indexEnd") {
          currentPart = "index";
          break;
        }
        if (isIgnoring) {
          isIgnoring = false;
          currentSegment += character;
          break;
        }
        if (currentPart === "property") {
          if (disallowedKeys.has(currentSegment)) {
            return [];
          }
          parts.push(currentSegment);
          currentSegment = "";
        }
        currentPart = "index";
        break;
      }
      case "]": {
        if (currentPart === "index") {
          parts.push(Number.parseInt(currentSegment, 10));
          currentSegment = "";
          currentPart = "indexEnd";
          break;
        }
        if (currentPart === "indexEnd") {
          throw new Error("Invalid character after an index");
        }
      }
      default: {
        if (currentPart === "index" && !digits.has(character)) {
          throw new Error("Invalid character in an index");
        }
        if (currentPart === "indexEnd") {
          throw new Error("Invalid character after an index");
        }
        if (currentPart === "start") {
          currentPart = "property";
        }
        if (isIgnoring) {
          isIgnoring = false;
          currentSegment += "\\";
        }
        currentSegment += character;
      }
    }
  }
  if (isIgnoring) {
    currentSegment += "\\";
  }
  switch (currentPart) {
    case "property": {
      if (disallowedKeys.has(currentSegment)) {
        return [];
      }
      parts.push(currentSegment);
      break;
    }
    case "index": {
      throw new Error("Index was not closed");
    }
    case "start": {
      parts.push("");
      break;
    }
  }
  return parts;
}
function isStringIndex(object, key) {
  if (typeof key !== "number" && Array.isArray(object)) {
    const index = Number.parseInt(key, 10);
    return Number.isInteger(index) && object[index] === object[key];
  }
  return false;
}
function getProperty(object, path, value) {
  if (!isObject(object) || typeof path !== "string") {
    return value === void 0 ? object : value;
  }
  const pathArray = getPathSegments(path);
  if (pathArray.length === 0) {
    return value;
  }
  for (let index = 0; index < pathArray.length; index++) {
    const key = pathArray[index];
    if (isStringIndex(object, key)) {
      object = index === pathArray.length - 1 ? void 0 : null;
    } else {
      object = object[key];
    }
    if (object === void 0 || object === null) {
      if (index !== pathArray.length - 1) {
        return value;
      }
      break;
    }
  }
  return object === void 0 ? value : object;
}

// src/supplementalFieldValues/addToDotSeparatedHierarchicalSet.ts
function addToDotSeparatedHierarchicalSet(set, newPath) {
  const tokens = newPath.split(".");
  const ancestorPaths = tokens.map((t, i) => tokens.slice(0, i + 1).join("."));
  if (!alreadyIncludedInDotSeparatedHierarchicalSet(set, ancestorPaths)) {
    const descendentsOfTheNewPath = Array.from(set).filter(
      (path) => path.startsWith(newPath)
    );
    descendentsOfTheNewPath.forEach((descendent) => set.delete(descendent));
    set.add(newPath);
  }
}
function alreadyIncludedInDotSeparatedHierarchicalSet(set, ancestorPaths) {
  for (const ancestorPath of ancestorPaths) {
    if (set.has(ancestorPath)) {
      return true;
    }
  }
  return false;
}

// src/supplementalFieldValues/index.ts
function unstable_useIconSupplementalFieldValue(fieldPath2) {
  const fieldValue = useSupplementalModuleFieldValue(fieldPath2);
  if ((fieldValue == null ? void 0 : fieldValue.type) === "icon") {
    return fieldValue.value;
  }
  return null;
}
function unstable_useRichTextSupplementalFieldValue(fieldPath2) {
  const fieldValue = useSupplementalModuleFieldValue(fieldPath2);
  if ((fieldValue == null ? void 0 : fieldValue.type) === "richtext") {
    return fieldValue.value;
  }
  return null;
}
function unstable_useFormSupplementalFieldValue(fieldPath2) {
  const fieldValue = useSupplementalModuleFieldValue(fieldPath2);
  if ((fieldValue == null ? void 0 : fieldValue.type) === "form") {
    return fieldValue.value;
  }
  return null;
}
function unstable_useCtaSupplementalFieldValue(fieldPath2) {
  const fieldValue = useSupplementalModuleFieldValue(fieldPath2);
  if ((fieldValue == null ? void 0 : fieldValue.type) === "cta") {
    return fieldValue.value;
  }
  return null;
}
function unstable_useMenuSupplementalFieldValue(fieldPath2) {
  const fieldValue = useSupplementalModuleFieldValue(fieldPath2);
  if ((fieldValue == null ? void 0 : fieldValue.type) === "menu") {
    return fieldValue.value;
  }
  return null;
}
function unstable_useSimpleMenuSupplementalFieldValue(fieldPath2) {
  const fieldValue = useSupplementalModuleFieldValue(fieldPath2);
  if ((fieldValue == null ? void 0 : fieldValue.type) === "simplemenu") {
    return fieldValue.value;
  }
  return null;
}
function useSupplementalModuleFieldValue(fieldPath2) {
  const renderContext = useRenderContext();
  useAddToSupplementalFieldValuesRead(fieldPath2);
  if (renderContext.supplementalFieldValues) {
    const supplementalFieldValueMeta = getProperty(
      renderContext.supplementalFieldValues,
      fieldPath2,
      null
    );
    if ((supplementalFieldValueMeta == null ? void 0 : supplementalFieldValueMeta.value) && Object.keys(supplementalFieldValueMeta.value).length > 0) {
      return supplementalFieldValueMeta;
    }
  }
  return null;
}
function useAddToSupplementalFieldValuesRead(fieldPath2) {
  if (import.meta.env.SSR) {
    const serverRenderContext = useServerRenderContext();
    if (!serverRenderContext.perServerRequestData.has(
      "supplementalFieldValuesRead"
    )) {
      serverRenderContext.perServerRequestData.set(
        "supplementalFieldValuesRead",
        /* @__PURE__ */ new Set()
      );
    }
    addToDotSeparatedHierarchicalSet(
      serverRenderContext.perServerRequestData.get(
        "supplementalFieldValuesRead"
      ),
      fieldPath2
    );
  }
}

// src/components/Icon.tsx
import { jsx as jsx7, jsxs } from "react/jsx-runtime";
function Icon(props) {
  const {
    id: id2,
    fieldPath: fieldPath2,
    iconStyle,
    purpose = "SEMANTIC",
    width,
    height,
    fill,
    title,
    ...rest
  } = props;
  const instanceId = useId4();
  const icon = unstable_useIconSupplementalFieldValue(fieldPath2);
  if (!icon) {
    return null;
  }
  const viewBox = icon.viewPort.join(" ");
  const uniqueId = `${icon.name}${id2 ?? instanceId}`;
  const svgPathTemplate = getSvgPathTemplate(iconStyle, icon);
  if (!svgPathTemplate) {
    return null;
  }
  return /* @__PURE__ */ jsxs(
    "svg",
    {
      id: id2,
      version: "1.0",
      xmlns: "http://www.w3.org/2000/svg",
      viewBox,
      "aria-labelledby": purpose === "SEMANTIC" ? uniqueId : void 0,
      role: purpose === "SEMANTIC" ? "img" : void 0,
      "aria-hidden": purpose === "DECORATIVE" ? true : void 0,
      width: width || void 0,
      height: height || void 0,
      fill: fill || void 0,
      ...rest,
      children: [
        purpose === "SEMANTIC" && title && /* @__PURE__ */ jsx7("title", { id: uniqueId, children: title }),
        /* @__PURE__ */ jsx7("path", { d: svgPathTemplate })
      ]
    }
  );
}
function getSvgPathTemplate(iconStyle, icon) {
  if (iconStyle && Object.hasOwn(icon.svg, iconStyle)) {
    return icon.svg[iconStyle];
  }
  if (icon.type && Object.hasOwn(icon.svg, icon.type)) {
    return icon.svg[icon.type];
  }
  if (Object.hasOwn(icon.svg, "REGULAR")) {
    return icon.svg["REGULAR"];
  }
  const templates = Object.values(icon.svg);
  if (templates.length > 0) {
    return templates[0];
  }
  return null;
}

// src/components/Cta.tsx
import { jsx as jsx8 } from "react/jsx-runtime";
var DEFAULT_TAG2 = "div";
function Cta({
  fieldPath: fieldPath2,
  tag: WrapperElement = DEFAULT_TAG2,
  ...otherHTMLAttributes
}) {
  const cta = unstable_useCtaSupplementalFieldValue(fieldPath2);
  if ((cta == null ? void 0 : cta.content) == null) {
    return null;
  }
  return /* @__PURE__ */ jsx8(
    WrapperElement,
    {
      dangerouslySetInnerHTML: { __html: cta.content },
      ...otherHTMLAttributes
    }
  );
}

// src/components/Form.tsx
import { jsx as jsx9 } from "react/jsx-runtime";
var DEFAULT_TAG3 = "div";
function Form({
  fieldPath: fieldPath2,
  tag: WrapperElement = DEFAULT_TAG3,
  ...otherHTMLAttributes
}) {
  const form = unstable_useFormSupplementalFieldValue(fieldPath2);
  if ((form == null ? void 0 : form.content) == null) {
    return null;
  }
  return /* @__PURE__ */ jsx9(
    WrapperElement,
    {
      dangerouslySetInnerHTML: { __html: form.content },
      ...otherHTMLAttributes
    }
  );
}

// src/components/RichText.tsx
import { jsx as jsx10 } from "react/jsx-runtime";
var DEFAULT_TAG4 = "div";
function RichText({
  fieldPath: fieldPath2,
  tag: WrapperElement = DEFAULT_TAG4,
  ...otherHTMLAttributes
}) {
  const richText = unstable_useRichTextSupplementalFieldValue(fieldPath2);
  if ((richText == null ? void 0 : richText.content) == null) {
    return null;
  }
  return /* @__PURE__ */ jsx10(
    WrapperElement,
    {
      dangerouslySetInnerHTML: { __html: richText.content },
      ...otherHTMLAttributes
    }
  );
}

// src/components/Menu.tsx
import { jsx as jsx11 } from "react/jsx-runtime";
var DEFAULT_TAG5 = "div";
function Menu({
  fieldPath: fieldPath2,
  tag: WrapperElement = DEFAULT_TAG5,
  ...otherHTMLAttributes
}) {
  const menu = unstable_useMenuSupplementalFieldValue(fieldPath2);
  if ((menu == null ? void 0 : menu.content) == null) {
    return null;
  }
  return /* @__PURE__ */ jsx11(
    WrapperElement,
    {
      dangerouslySetInnerHTML: { __html: menu.content },
      ...otherHTMLAttributes
    }
  );
}

// src/components/SimpleMenu.tsx
import { jsx as jsx12 } from "react/jsx-runtime";
var DEFAULT_TAG6 = "div";
function SimpleMenu({
  fieldPath: fieldPath2,
  tag: WrapperElement = DEFAULT_TAG6,
  ...otherHTMLAttributes
}) {
  const simpleMenu = unstable_useSimpleMenuSupplementalFieldValue(fieldPath2);
  if ((simpleMenu == null ? void 0 : simpleMenu.content) == null) {
    return null;
  }
  return /* @__PURE__ */ jsx12(
    WrapperElement,
    {
      dangerouslySetInnerHTML: { __html: simpleMenu.content },
      ...otherHTMLAttributes
    }
  );
}

// src/components/Script.tsx
import { jsx as jsx13 } from "react/jsx-runtime";
function UnsafeScript({
  js,
  ...otherProps
}) {
  return /* @__PURE__ */ jsx13(
    "script",
    {
      nonce: getScriptNonce(),
      ...otherProps,
      dangerouslySetInnerHTML: { __html: js }
    }
  );
}

// src/data/dataDependencyHelpers.ts
var HS_MODULE_DATA_FETCH_DEP_SYMBOL = Symbol.for("hsServerSideDeps");
function getModuleDataDependecyTypeFrom(func) {
  const dep = func[HS_MODULE_DATA_FETCH_DEP_SYMBOL];
  if (ALL_MODULE_DATA_FETCH_DEPENDENCY_TYPES.includes(dep)) {
    return dep;
  }
  return void 0;
}
var UrlWithoutQuery = class extends URL {
  static from(url) {
    const inputUrl = new URL(url);
    inputUrl.search = "";
    return new UrlWithoutQuery(inputUrl.toString());
  }
  get search() {
    return "";
  }
  get hash() {
    return "";
  }
  get password() {
    return "";
  }
  get hasNoQuery() {
    return true;
  }
};
function getModuleDataDependenciesAsObjectFrom(depType) {
  return MODULE_DATA_FETCH_DEPENDENCY_AS_OBJECT.get(depType);
}
function filterToModuleDataDepsIncludedIn(depType, {
  url,
  contact,
  request
}) {
  const deps = getModuleDataDependenciesAsObjectFrom(depType);
  const extraDeps = {};
  if (deps.urlWithQuery) {
    extraDeps.url = url;
  } else if (deps.urlWithoutQuery) {
    extraDeps.url = UrlWithoutQuery.from(url);
  }
  if (deps.contact) {
    extraDeps.contact = contact;
  }
  if (deps.fullRequest) {
    extraDeps.request = request;
  }
  return extraDeps;
}
function withServerSideDeps(depType, func) {
  if (depType === "moduleProps-urlWithoutQuery") {
    const builtFunc = function getServerSideProps(props, { url }) {
      const extraDeps = { url };
      return func(props, extraDeps);
    };
    builtFunc[HS_MODULE_DATA_FETCH_DEP_SYMBOL] = depType;
    return builtFunc;
  } else if (depType === "moduleProps-urlWithQuery") {
    const builtFunc = function getServerSideProps(props, { url }) {
      const extraDeps = { url };
      return func(props, extraDeps);
    };
    builtFunc[HS_MODULE_DATA_FETCH_DEP_SYMBOL] = depType;
    return builtFunc;
  } else if (depType === "moduleProps-urlWithQuery-contact") {
    const builtFunc = function getServerSideProps(props, { url, contact }) {
      const extraDeps = { url, contact };
      return func(props, extraDeps);
    };
    builtFunc[HS_MODULE_DATA_FETCH_DEP_SYMBOL] = depType;
    return builtFunc;
  } else if (depType === "moduleProps-urlWithQuery-contact-fullRequest") {
    const builtFunc = function getServerSideProps(props, {
      url,
      contact,
      request
    }) {
      const extraDeps = { url, request, contact };
      return func(props, extraDeps);
    };
    builtFunc[HS_MODULE_DATA_FETCH_DEP_SYMBOL] = depType;
    return builtFunc;
  } else if (depType === "moduleProps") {
    const builtFunc = function getServerSideProps(props) {
      return func(props);
    };
    builtFunc[HS_MODULE_DATA_FETCH_DEP_SYMBOL] = depType;
    return builtFunc;
  } else {
    const builtFunc = function getServerSideProps(props) {
      return func(props);
    };
    builtFunc[HS_MODULE_DATA_FETCH_DEP_SYMBOL] = "moduleProps";
    return builtFunc;
  }
}
function withModuleProps(func) {
  return withServerSideDeps("moduleProps", func);
}
function withUrlPath(func) {
  return withServerSideDeps("moduleProps-urlWithoutQuery", func);
}
function withUrlAndQuery(func) {
  return withServerSideDeps("moduleProps-urlWithQuery", func);
}
function withContact(func) {
  return withServerSideDeps("moduleProps-urlWithQuery-contact", func);
}
function withRequest(func) {
  return withServerSideDeps(
    "moduleProps-urlWithQuery-contact-fullRequest",
    func
  );
}

// src/descriptors/Module.tsx
import { jsx as jsx14 } from "react/jsx-runtime";
function Module(props) {
  const { name, path, label } = props;
  useAddModule(name, path, label);
  return /* @__PURE__ */ jsx14(
    "div",
    {
      dangerouslySetInnerHTML: {
        __html: `<!-- hs-module-placeholder-${name} -->`
      }
    }
  );
}
function useAddModule(name, path, label) {
  if (!import.meta.env.SSR) {
    throw new Error("Cannot call useAddModule in the browser");
  }
  const renderContext = useServerRenderContext();
  const moduleValue = { name, path };
  if (label) {
    moduleValue.label = label;
  }
  renderContext.modules = {
    ...renderContext.modules,
    [name]: moduleValue
  };
  renderContext.contentDescriptors = {
    ...renderContext.contentDescriptors,
    modules: {
      ...renderContext.contentDescriptors.modules,
      [name]: moduleValue
    }
  };
}

// src/descriptors/DndArea.tsx
import { jsx as jsx15 } from "react/jsx-runtime";

// src/templates/index.ts
var supportedTemplateTypeMap = { page: 4 };

// src/internal/serverSidePropsDataFetching.ts
async function renderServerSidePropsWithAsyncLocalStoreContext(getServerSideProps, propsAndDeps, renderContext) {
  var _a;
  if (propsAndDeps.extraDeps.url && ((_a = propsAndDeps.extraDeps) == null ? void 0 : _a.url.toString()) !== renderContext.pageUrl) {
    renderContext.pageUrl = propsAndDeps.extraDeps.url.toString();
  }
  const { props, extraDeps } = propsAndDeps;
  let resultPromise;
  await wrapServerCodeWithRenderContext(renderContext, () => {
    resultPromise = Promise.resolve(getServerSideProps(props, extraDeps));
  });
  return resultPromise;
}
export {
  ALL_MODULE_DATA_FETCH_DEPENDENCY_TYPES,
  ClientRenderContextProvider,
  Cta,
  ExistingIslandContextProvider,
  Form,
  ISO639CodeEnum,
  Icon,
  Island_default as Island,
  MAX_AGE_CACHE_FOR_AN_HOUR,
  MODULE_DATA_FETCH_DEPENDENCY_AS_OBJECT,
  Menu,
  Module,
  RichText,
  RichTextFieldWrapper,
  SCRIPT_NONCE_PLACEHOLDER,
  STYLE_NONCE_PLACEHOLDER,
  ServerRenderContext,
  SharedIslandReducer,
  SharedIslandState,
  SharedIslandStateContext,
  SimpleMenu,
  UNSET_SHARED_STATE_ID,
  UnsafeScript,
  UrlWithoutQuery,
  buildIslandID,
  buildIslandIdentifierPrefix,
  buildStaticEnvConfig,
  createEmptyServerRenderContext,
  createServerRenderContext,
  createServerRenderContextV2,
  fieldPath,
  filterToModuleDataDepsIncludedIn,
  getHSEnv,
  getPortalID as getHubID,
  getHublet,
  getIsDeployed,
  getIsUngatedFor,
  getModuleDataDependecyTypeFrom,
  getModuleDataDependenciesAsObjectFrom,
  getPortalID,
  getScriptNonce,
  getSecret,
  getStyleNonce,
  id,
  isDebugUrl,
  isDebugUrlString,
  logError,
  logErrorDebugOnly,
  logInfo,
  logInfoDebugOnly,
  logWarn,
  logWarnDebugOnly,
  mergeServerRequestData_internal,
  pushHistoryState,
  renderServerSidePropsWithAsyncLocalStoreContext,
  setSecrets,
  setSecretsFromEnv,
  sortIslandRootsByPriority,
  supportedTemplateTypeMap,
  unstable_usePodcastEpisodes,
  unstable_usePodcastShows,
  unstable_useVideos,
  useAfterIslandHydration,
  useAvailableTranslations,
  useBasePath,
  useBrandSettings,
  useClientRenderContext,
  useEditorVariableChecks,
  useGetPerRequestMap_internal,
  useGetRenderRequestId,
  useHasSharedIslandState,
  useInitialPageUrl,
  useInlineHeadAsset,
  useIsAfterMountWithoutForcingRerender,
  useIsDebug,
  useIsInsideIsland,
  useIsServerOrFirstClientRender,
  useIsServerRender,
  useLanguageVariants,
  useMenu,
  usePageUrl,
  useRenderContext,
  useServerRenderContext,
  useSharedIslandReducer,
  useSharedIslandReducerInternal,
  useSharedIslandState,
  useSharedIslandStateID,
  withContact,
  withModuleProps,
  withRequest,
  withUrlAndQuery,
  withUrlPath
};
